Admin redirects for HPOS URLs #35463
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If HPOS is disabled, or COT is no longer authoritative, then requests to access HPOS admin screens should result in redirects to the corresponding legacy order screen.
Closes #35074.
How to test the changes in this Pull Request:
/wp-admin/admin.php?page=wc-orders: you should be redirected to the equivalent order post screen atwp-admin/edit.php?post_type=shop_order.wp-admin/edit.php?post_type=shop_order&paged=3: you should be redirected to/wp-admin/edit.php?paged=3&post_type=shop_order(assuming you have at least 3 pages of order data)./wp-admin/admin.php?page=wc-orders&action=new: you should be redirected to/wp-admin/post-new.php?post_type=shop_order(simulates manually creating a new order).https://wordpress.lab/wp-admin/admin.php?page=wc-orders&action=edit&id=123: you should be redirected to/wp-admin/post.php?action=edit&post=123(of course, change 123 to the ID of an actual existing order within your test site).Now a more advanced test.
/wc-admin/admin.php?page=wc-ordersand select one or more orders, then perform a bulk action such as changing the order status to Completed./wp-admin/admin.php?page=wc-orders&_wpnonce=ABCDEF&_wp_http_referer=%2Fwp-admin%2Fadmin.php%3Fpage%3Dwc-orders&action=mark_completed&order%5B%5D=1&order%5B%5D=2&action2=mark_completed(but you may also see some extra query parameters in there).mark_completedtomark_processing. An appropriate redirect should take place and the bulk action should be processed, in this case resulting in the two orders being set back to "Processing".Other information:
pnpm --filter=<project> changelog add?FOR PR REVIEWER ONLY: