Tag: How to Sort WordPress

  • How to Sort WordPress Taxonomy Dropdowns by Date Using ACF

    Issue Background:

    The “Browse by Magazine Issue” dropdown under Book Reviews displayed items alphabetically by title (e.g., “HNR Issue 102”), not by actual publication date. This was affecting the WordPress site structure because the taxonomy term order didn’t respect the custom date field. A legacy fix required a plugin toggle every quarter to manually input dates—leading to conflicts, inconsistent sorting, and issues when using custom taxonomies for content display.

    What We Did:

    • Created a permanent ‘Issue Date’ field:
      Added a custom date field to the mag_edition taxonomy using Advanced Custom Fields (ACF) and ACF taxonomy field configuration, replacing the old plugin workaround. 
    • Updated the admin experience:
      Admins can now add or edit the publication date directly within the taxonomy term editor—no plugin toggles required. The backend now stores the field value properly using an ACF date structure that works smoothly with WordPress custom functionality.
    • Rebuilt the front-end dropdown logic:
      The dropdown now queries taxonomy terms using a dynamic array and sorts them in reverse chronological order using the new field. Instead of alphabetical display, it fetches the correct values via meta query parameters and processes them through custom query loops so WordPress taxonomies like mag_edition sort by actual dates.
    • Populated live dates:
      Historical magazine issues were updated with proper dates, so the dropdown reflects accurate ordering from oldest to newest. This ensures the taxonomy fields and custom date field values remain consistent with the custom post type relationships and prevent outdated default sorting behavior.
    Need help organizing your content better?

    Integriti Studio builds smart, scalable WordPress solutions that make content easy to manage and even easier to navigate.

    Frequently Asked Questions (How to Sort WordPress Taxonomy Dropdowns by Date Using ACF)

    Can ACF taxonomy fields be sorted by date?

    Yes, ACF taxonomy dropdowns can be sorted by date using custom PHP filters. By modifying the get_terms query with arguments like orderby and meta_value, you can control term order based on creation date or custom term meta.

    Does WordPress support taxonomy sorting by default?

    By default, WordPress sorts taxonomy terms alphabetically. Sorting by date or custom fields requires custom code using get_terms, acf/load_field, or acf/fields/taxonomy/query filters.

    How do I sort taxonomy terms by custom date field in ACF?

    You can store a date as term meta using ACF, then hook into acf/fields/taxonomy/query and set meta_key, orderby => meta_value, and order => DESC to sort terms by that date field.

    Will this affect frontend taxonomy display?

    No, this customization only affects the ACF dropdown field in the admin or frontend form. It does not change how taxonomy terms are displayed on the website unless you apply similar sorting to frontend queries.