- Help Center Home
- Getting started
- Introducing FacetWP
- Installation and updates
- FAQ
- How it works
- What are facets?
- Facet types
- Built-in facet types
- Checkboxes
- Dropdown
- Radio
- fSelect
- Hierarchy
- Slider
- Search
- Autocomplete
- Date Range
- Number Range
- Rating
- Proximity
- Map
- Pager + load more
- Sort
- Reset
- User Selections
- Add-on facet types
- Hierarchy Select
- Range List
- Time Since
- A-Z Listing
- Color
- Legacy facet types
- Proximity (legacy)
- Map (legacy add-on)
- Custom facet types
- Custom facet types
- Indexing
- Listing templates
- Extras & integrations
- Add-on features and extras
- Using FacetWP with …
- Built-in integrations
- Advanced Custom Fields
- WooCommerce
- SearchWP
- WP-CLI
- Add-on integrations
- Blocks
- Bricks
- Elementor
- Beaver Builder
- WP Recipe Maker and Tasty Recipes
- Relevanssi
- WPML and Polylang
- Meta Box
- Flatsome (theme)
- External integrations
- Breakdance
- Document Library Pro
- Listify (theme)
- Listable (theme)
- WPGraphQL
- Tips, tricks and known issues
- WordPress multi-site
- WP All Import
- WebToffee Import Export
- Intuitive Custom Post Order
- Custom Taxonomy Order
- Category Order and Taxonomy Terms Order
- Advanced Taxonomy Terms Order
- Post Types Order
- Easy Digital Downloads
- EDD Reviews
- WP Job Manager
- Genesis framework
- WP External Links
- ElasticPress
- Yoast SEO
- All in One SEO (Pro)
- The Events Calendar (Pro)
- Google Analytics 4
- Image Optimization by Optimole
- Meow Lightbox
- Cookiebot
- Members
- MemberPress
- Caching, hosting & security
- Object caching
- WP Rocket
- Cloudflare
- WP Engine
- Pressable
- New Relic
- WordPress REST API Authentication
- All-In-One Security (AIOS)
- Fast Velocity Minify
- Incompatibilities
- Incompatible plugins and themes
- Troubleshooting
- Troubleshooting guide
- Using the right query
- Common issues
- Common indexing issues
- Get support
- Developers
- Hooks reference
- Indexing hooks
- Querying hooks
- Output hooks
- facetwp_facet_display_value
- facetwp_facet_html
- facetwp_facet_render_args
- facetwp_facet_pager_link
- facetwp_facet_sort_options
- facetwp_template_html
- facetwp_shortcode_html
- facetwp_render_params
- facetwp_render_output
- facetwp_builder_item_value
- facetwp_builder_dynamic_tags
- facetwp_builder_dynamic_tag_value
- Advanced hooks
- Deprecated hooks
- JavaScript reference
- Shortcodes reference
- How FacetWP works
- The FacetWP URL
- FacetWP speed and limits
- FacetWP and taxonomies
- FacetWP REST API
- Tutorials
- Code snippets library
- Feedback
- What’s new
- News and announcements
- Changelog
How can I order a query by terms or categories?
Although this is not really FacetWP-related, we often get this question. With the bonus question of how to add a term heading above each group of posts sharing a term/category.
The orderby parameter in WP_Query can be used to order by many things, including custom fields. But unfortunately, ordering by taxonomy terms or categories is not directly possible.
We wrote this tutorial that explores two different workarounds to accomplish this. Both approaches order a query by terms or categories in a custom WP_Query template, then (optionally) output a heading above each group of posts in a term/category, and wrap each group in a container element (for styling).
Both workarounds are quite complicated to implement and may not work in all situations. So if you can avoid this, we recommend using another built-in orderby parameter.
See also
- How to order a WP_Query by terms or categories
- How to filter or order a WP_Query by one or more custom fields
- Random ordering in FacetWP
- Using a custom WP_Query
- Using a WP archive page
- How to customize WordPress archive queries
- The facetwp_query_args hook
- How to use sticky posts with FacetWP
- How to use the offset query argument with FacetWP
Last updated: December 18, 2025
Related articles
- How to order a WP_Query by terms or categories
- How to filter or order a WP_Query by one or more custom fields
- Random ordering in FacetWP
- Using a custom WP_Query
- Using a WP archive page
- How to customize WordPress archive queries
- The facetwp_query_args hook
- How to use sticky posts with FacetWP
- How to use the offset query argument with FacetWP