0

I have a page and I'm currently printing out the product categories with the shortcode [product_categories limit="5"]. Currently, I get the first 5 alphabetically. I want to order by date ASC.

I've tried orderby="date" but it doesn't work. Is there a simply way to fix this, or do I have to make some filter functions?

Thanks in advance!

0

As you are using the [product_categories] shortcode, you query for taxonomy / terms, and not posts. Other than posts, terms can not be ordered using date, as terms did not save the date they were added or modified.

When you are querying for terms you can use the following orderby parameters:

  • name - Default
  • count
  • slug
  • term_group
  • term_order
  • term_id
  • none

Take a look at WP_Term_Query parameters in the codex.
So no, you cannot order terms by date.

Also I cannot tell you if the WC shortcode supports all these orderby parameters from the get go.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.