Opened 8 years ago
Last modified 8 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: | giuse | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Awaiting Review |
| Component: | Query | Version: | |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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
@
8 years ago
Replying to SergeyBiryukov:
Hi @giuse, welcome to WordPress Trac! Thanks for the report.
orderis one of the reserved terms in WordPress. In WP_Query::parse_order(), any value other thanASCis treated asDESC.
If the home page is set to display the latest posts, adding
?order=somethingdoesn'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
@
8 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;
}
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Hi @giuse, welcome to WordPress Trac! Thanks for the report.
orderis one of the reserved terms in WordPress. In WP_Query::parse_order(), any value other thanASCis treated asDESC.If the home page is set to display the latest posts, adding
?order=somethingdoesn'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.