0

I have setup a Wp_Query on a page template that queries woocommerce products. When not set as the front page my orderby filtering works perfectly. However when trying to use orderby on a static front page it redirects to the index.php page.

This works:

www.mydomain.com/clothing/?orderby=title&order=asc

This redirects to my index.php template when clothing is set as static front page

www.mydomain.com/?orderby=title&order=asc

Its odd because I am able to filter by categories, tags, attributes, meta with no problem even when set as a static front page.

www.mydomain.com/?cats=mens&tags=shirts&color=black&price=60,155

Not sure what I am missing.

  • 1
    Can we see code? – Tom J Nowell Jun 6 '15 at 11:03
  • I don't see the problem, that's correct behaviour - redirect_canonical() – TheDeadMedic Jun 6 '15 at 12:27
  • I am trying to find out if Wordpress handles orderby differently when on the front page like with pagination you need to use 'page' instead of 'paged' with a custom page query. As far as code I would put it up but its very complex, however the orderby filtering is applied using pre_get_posts and the custom query on the page is built using a shortcode. – Benjamin Jun 6 '15 at 12:30
  • @TheDeadMedic are you saying that is the expected behavior, that you should not be able to sort posts on a static front page, sorry not really understanding. I know if I add a special woocommerce query var ?post_type=product into the url then ?post_type=product&orderby=title will sort my posts correctly but that var causes a rewrite rule to get triggered and it redirects to the Shop page. – Benjamin Jun 6 '15 at 12:43
  • The redirect is the expected behaviour - WordPress will canonicalize the request. – TheDeadMedic Jun 6 '15 at 12:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.