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

Some canonicals not localised (Yoast) #1032

Closed
pjrobertson opened this issue May 26, 2021 · 4 comments
Closed

Some canonicals not localised (Yoast) #1032

pjrobertson opened this issue May 26, 2021 · 4 comments
Labels
module: yoast Integration with yoast

Comments

@pjrobertson
Copy link
Contributor

pjrobertson commented May 26, 2021

Some canonicals are not localised when using the YOAST plugin/module.

Right now, the only one I can tell that isn't working is the 'Shop' page for a Woocommerce install. To reproduce:

  1. Create a new page in Wordpress, call it 'Shop'
  2. Go to the Woocommerce settings and set this new page as your 'shop' page
  3. Load page and note rel="canonical" URL in the source code. See that the language code is missing.

This causes errors with Google on indexing these URLs.

To fix, add this to the qtranslate-xt Yoast module (wp-seo-frontend.php):

    add_filter('wpseo_canonical', 'qtranxf_checkCanonical', 10, 2);

P.S. @herrvigg I am testing out your complete rewrite of the Yoast module. Congratulations, and great work. Thanks so much for your effort on this project!

@herrvigg herrvigg added the module: yoast Integration with yoast label May 29, 2021
herrvigg added a commit that referenced this issue May 29, 2021
@herrvigg
Copy link
Collaborator

Thank you! Merged in master.

@herrvigg
Copy link
Collaborator

herrvigg commented Jun 2, 2021

Release in 3.10.1.

@herrvigg herrvigg closed this as completed Jun 2, 2021
@Tusko
Copy link
Contributor

Tusko commented Jul 8, 2021

[Thu Jul 08 10:50:58.487198 2021] [php7:error] [pid 13770] [client 144.76.91.79:50980] PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function qtranxf_checkCanonical(), 1 passed in /var/www/podillya.com.ua/wp-includes/class-wp-hook.php on line 288 and exactly 2 expected in /var/www/podillya.com.ua/wp-content/plugins/qtranslate-xt-3.10.1/qtranslate_frontend.php:855\nStack trace:\n#0 /var/www/podillya.com.ua/wp-includes/class-wp-hook.php(288): qtranxf_checkCanonical('https://podilly...')\n#1 /var/www/podillya.com.ua/wp-includes/plugin.php(206): WP_Hook->apply_filters('https://podilly...', Array)\n#2 /var/www/podillya.com.ua/wp-content/plugins/wordpress-seo/frontend/class-frontend.php(1014): apply_filters('wpseo_canonical', 'https://podilly...')\n#3 /var/www/podillya.com.ua/wp-content/plugins/wordpress-seo/frontend/class-frontend.php(868): WPSEO_Frontend->generate_canonical()\n#4 /var/www/podillya.com.ua/wp-includes/class-wp-hook.php(288): WPSEO_Frontend->canonical('')\n#5 /var/www/podillya.com.ua/wp-includes/class-wp-hook.php(312): WP_Hook->apply_filters('max-snippet:-1,...', Array)\n#6 /var/www/podil in /var/www/podillya.com.ua/wp-content/plugins/qtranslate-xt-3.10.1/qtranslate_frontend.php on line 855

how can I fix it?

@Tusko
Copy link
Contributor

Tusko commented Jul 8, 2021

fixed with updating Qtranslate and Yoast SEO to the latest versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module: yoast Integration with yoast
Projects
None yet
Development

No branches or pull requests

3 participants