I am also having this issue. I downloaded the Taxonomies Reorder plugin, but actually it is not the taxonomies, it is the dropdown items of each taxonomy that are in the wrong order. So that plugin doesn’t help. Any ideas from anyone out there?
Plugin Support
Nick C
(@modernnerd)
The search widget drop-down options display based on the ‘count’ of Listings for each taxonomy term (terms with the most listings will appear first in each drop-down).
There is no AgentPress-specific filter to change the order, but you could filter on get_terms, like this:
add_filter( 'get_terms', 'custom_agentpress_term_sort_order', 10, 4 );
/**
* Change AgentPress to sort taxonomy by ID instead of by count.
*
* @param array $terms Array of found terms.
* @param array $taxonomies An array of taxonomies.
* @param array $args An array of get_terms() arguments.
* @param WP_Term_Query $term_query The WP_Term_Query object.
* @return array
*/
function custom_agentpress_term_sort_order( $terms, array $taxonomies, array $args, $term_query ) {
if ( is_admin() ) {
return $terms;
}
if ( in_array( 'area', $taxonomies, true ) ) {
$args['orderby'] = 'ID';
$args['order'] = 'ASC';
return $term_query->query( $args );
}
return $terms;
}
Add the code to your active theme’s functions.php file, then replace ‘area’ with your taxonomy slug as it appears in the Listings → Register Taxonomies section.
You could repeat the second if block for each taxonomy and specify the orderby and order values for each term.
-
This reply was modified 8 years, 8 months ago by
Nick C.
Thank you so much, Nick Cernis, you are brilliant. This worked perfectly.