WooCommerce Services: Fix the redirect URL for Woo Services JITM CTAs#13752
WooCommerce Services: Fix the redirect URL for Woo Services JITM CTAs#13752
Conversation
|
Thank you for the great PR description! When this PR is ready for review, please apply the Scheduled Jetpack release: November 5, 2019. |
There was a problem hiding this comment.
This works well for me, it should be good to merge.
Fix most of the PHPCS errors and warnings in 3rd-party/woocommerce-services.php
Thank you for that!
I hope you don't mind, I figured I'd take care of that last warning and add the file to the pre-commit hook whitelist: e687f337ff207b56e3f4afee20b9fdd426a05c7c
The redirect URL is created using the value of $_SERVER['REQUEST_URI'], which includes 'wp-admin/'. When admin_url() is used to create the redirect URL, the resulting URL is incorrect. Use home_url() instead. Also properly unslash and sanitize $_GET['redirect'].
In PR #9239, wp_get_referer() was described as unrealiable because some browsers strip the 'referer' header. So let's just use admin_url() as the fallback redirect URL if $_GET['redirect'] is empty.
e687f33 to
73c5479
Compare
|
Rebased against |
|
I may be doing something wrong, the JITM isn't loading. @jeherve Can you give it a go or I'll try again tomorrow. |
I think you're not seeing it because my testing instructions missed a step. Sorry about that 😦 You also need to add at least one order:
|
* 7.9: Changelog * Update version number * Update stable tag and tested up to * Changelog: add #13530 * changelog: add #13578 * Changelog: add #13598 * Changelog: add entry for numerous block preview changes * Changelog: add #13599 * changelog: add #13541 * Changelog: add #13542 * Changelog: add #13331 * Changelog: add #13558 * Changelog: add #13409 * Changelog: add #13582 * Changelog: add #13600 * Changelog: add #13601 * Changelog: add #13595 * Changelog: add #12695 * Changelog: add #13009 * Changelog: add #13649 * Changelog: add #13450 * Changelog: add #13507 * Changelog: add #13658 * Changelog: add #13687 * changelog: add #13683 * Changelog: add #9323 * Changelog: add #13681 * Fix typos in readme * Add link to WordPress Beta Tester plugin * Changelog: add #13630 * Changelog: add #13695 * Changelog: add #13659 * Changelog: add #13716 * Changelog: add #13664 * Changelog: add #13682 * Changelog: add #13362 * Changelog: add #13563 * Add testing list for #13563 * Changelog: add #13735 * Changelog: add #13752 * Changelog: add #13624 * Changelog: add #13756 * Changelog: add #13745 * Changelog: add #13728 * Changelog: add #13779 * Changelog: add #13699 * Changelog: add #13804 * Changelog: add #13761 * Changelog: add #13637 * Changelog: add #13517 * Changelog: add #13521 * Changelog: add #13729 * Testing list: add testing instructions for #13729 * Changelog: add sync changes * Changelog: add #13807 * Changelog: add #13654 * Changelog: add #13795 * Changelog: add #13801 * Changelog: add #13818 * Changelog: add #13725 * Changelog: add #13831 * Changelog: add #13516 * Testing list: add Twenty Twenty instructions * Changelog: add #13799 * Changelog: add #13805 * Changelog: add #13688 * Changelog: add #13830
The redirect after clicking a Woo Services JITM CTA leads to a 404.
Changes proposed in this Pull Request:
home_url()instead ofadmin_url()to create the redirect URL.$SERVER['REQUEST_URI']is used to create the redirect URL, and it includeswp-admin/. So, the redirect URL created usingadmin_url()will include an extrawp-admin/. Fix this by usinghome_url(), which does not includewp-admin/.$_GET['redirect']is empty.3rd-party/woocommerce-services.phpIs this a new feature or does it add/remove features to an existing part of Jetpack?
Testing instructions:
NOTE: The changes in PR #13720 are required to test this branch. Without those changes, the redirect fixed in this PR doesn't occur.
wp-admin/wp-admin/admin.php?page=wc-settingsProposed changelog entry for your changes: