wordpress-seo
wordpress-seo copied to clipboard
Fix Paginated URL if there are query params
Context
- Fix the pagination url to show the query params at the end and not in the middle.
Summary
This PR can be summarized in the following changelog entry:
- Fixed paginated canonical URL when we are having query params in the url.
Relevant technical choices:
Test instructions
- Set up WooCommerce
- Install Yoast SEO
- Create 3 products and translate
- Go to Appearance > Customize > WooCommerce > Product catalog > Set "Products per row:2" and "Rows per page:1"
- Add this snippet in
functions.php
of the current theme
add_filter( 'page_link', function( $url ) {
return add_query_arg( 'foo', 'bar', $url );
} );
- Check page source and the canonical entry
- The canonical link should shows something like this
/page/page/2/?foo=bar
Test instructions for the acceptance test before the PR gets merged
This PR can be acceptance tested by following these steps:
- The test steps for the acceptance can be the same as test instructions
Test instructions for QA when the code is in the RC
- [X] QA should use the same steps as above.
QA can test this PR by following these steps:
Impact check
This PR affects the following parts of the plugin, which may require extra testing:
UI changes
- [ ] This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.
Other environments
- [ ] This PR also affects Shopify. I have added a changelog entry starting with
[shopify-seo]
, added test instructions for Shopify and attached theShopify
label to this PR.
Documentation
- [ ] I have written documentation for this change.
Quality assurance
- [x] I have tested this code to the best of my abilities
- [ ] I have added unittests to verify the code works as intended
- [ ] If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
- [ ] I have written this PR in accordance with my team's definition of done.
Fixes https://github.com/Yoast/wordpress-seo/issues/18275
Also experiencing this issue. Any update on when this will fix will be merged?
Any chance that this gets merged?
Hi, I have exactly the same problem. Is there a chance that it will be fixed in the near future?
@andreas-pa thank you for this solution!
We've used the bulk of it and created a (draft, for now) PR for this, where we intend to give you props 😃
It's going to go through our normal processes after we finalize it with Test Instructions and Impact check, but your own PR gave us a great starting point, so thank you for that 🎉
Is there any progress on this issue?
This has been merged separately here and rolled out with the Yoast SEO 20.3 release @Ryshev :)
I'm gonna close this PR now to avoid any further confusion.