Opened 6 years ago
Last modified 6 years ago
#45666 new defect (bug)
adding "order" as query arg to the homepage url you are redirected to the last posts page
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Query | Keywords: | |
Focuses: | Cc: |
Description
I've tested it on many sites, with different plugins, no plugins, different themes, default WordPress themes. If you add ?order=something to the home page url you have a redirection to the last posts page.
Change History (3)
#2
in reply to:
↑ 1
@
6 years ago
Replying to SergeyBiryukov:
Hi @giuse, welcome to WordPress Trac! Thanks for the report.
order
is one of the reserved terms in WordPress. In WP_Query::parse_order(), any value other thanASC
is treated asDESC
.
If the home page is set to display the latest posts, adding
?order=something
doesn't seem to affect anything.
If a static home page is selected in Reading Settings, this parameter does indeed show the list of latest posts instead of the home page, but I don't necessarily see an issue with that.
I see a very big issue because WooCommerce uses this query argument in the download link for a digital product. If the customer clicks on that link instead to download the product sees the last posts.
In any case this is not normal and I think it can be easily avoided.
#3
@
6 years ago
for people who have a shop with downloadable products who probably have my same problem, until WooCommerce or WordPress don’t find a clean solution, I suggest to use this dirty solution in functions.php:
if( !isset( $_GET[‘redirected’] ) && isset( $_GET[‘order’] ) && strpos( $_GET[‘order’],’wc_order’ ) === 0 ){
$_GET[‘redirected’] = true;
wp_redirect( add_query_arg( $_GET,get_permalink( get_option( ‘woocommerce_checkout_page_id’ ) ) ) );
exit;
}
Hi @giuse, welcome to WordPress Trac! Thanks for the report.
order
is one of the reserved terms in WordPress. In WP_Query::parse_order(), any value other thanASC
is treated asDESC
.If the home page is set to display the latest posts, adding
?order=something
doesn't seem to affect anything.If a static home page is selected in Reading Settings, this parameter does indeed show the list of latest posts instead of the home page, but I don't necessarily see an issue with that.