Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

msls_options_get_permalink filter not working with WooCommerce product_cat #118

Closed
llos opened this issue May 9, 2018 · 6 comments
Closed

Comments

@llos
Copy link

llos commented May 9, 2018

I’m using msls_options_get_permalink to control de rewrite of some custom taxonomies and it works fine. However, it doesn’t work fine with product_cat woocommerce taxnomy. It seem to be some kind of conflict with its rewrite, maybe because you can choose it from back-end?
This issue has been already posted here https://wordpress.org/support/topic/msls_options_get_permalink-filter-not-working-with-woocommerce-product_cat/

@lloc lloc added the Bug label Dec 20, 2018
@lloc lloc added the Woo label Dec 30, 2018
@llos
Copy link
Author

llos commented May 29, 2019

Hi @lloc,

Any updates regarding this problem? Is there anything we can do to help you debug this? Do you have any idea of where the problem can come from?

Thank you in advance.

@Tepeek
Copy link

Tepeek commented Sep 26, 2019

Hi guys,
I have the same problem. I am trying to solve this problem... But I've been trying for over a year. It doesn't works with product-cat and product-tag. Even though the custom filter below, works with everything else on the website, except with WooCommerce. (Example: Sculpture Page).

filtre-msls

I'll let you know about the progress...

@Tepeek
Copy link

Tepeek commented Oct 2, 2019

Hi, There, it's done!
I ended up finding a solution... I hope it's the right one. In my case, it works very well for product categories as well as for product tags.

Here's what I changed in the file "includes/MslsOptionsTax.php", line 128:

`/**
 * Wraps the call to get_term_link
 *
 * @param int $term_id
 *
 * @return string
 */
public function get_term_link( $term_id ) {
	if ( ! empty( $term_id ) ) {
		$taxonomy = $this->get_tax_query();
		if ( ! empty( $taxonomy ) ) {
			$link = get_term_link( $term_id, $taxonomy );
			if ( ! is_wp_error( $link ) ) {
				return $link;
			}
		}
	}
	return apply_filters( 'check_url', get_term_link( $term_id ), $this );
}`

Enjoy!

@lloc
Copy link
Owner

lloc commented Oct 5, 2019

Interesting would you mind to send a pull-request? Or do you prefer that just I test and integrate your code?

@Tepeek
Copy link

Tepeek commented Oct 5, 2019

Hi Dennis and frankly a big congratulations for your great plugin! Ok, For my part, I did tests with the latest versions of Woocommerce and WordPress; Thus that PHP 7.0.x. Now, with your approval, I would like it to be integrated in a future version of your Plugin.

I read somewhere that Woocommerce is not what you prefer... or at least you did not develop MSLS for it. Anyway, I can confirm that it works very well! For it to be perfect, maybe make sure the x-default tag:

rel="alternate" hreflang="x-default"

present everywhere, not just when there are no translations, because, for SEO rules, if an user does not find his native language, if possible, must indicate the origin language of the website. What do you think about it?

Voilà !

@lloc
Copy link
Owner

lloc commented Nov 14, 2024

Close this in favor of: #399

@lloc lloc closed this as completed Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants