Skip to content
billerickson edited this page Jul 4, 2012 · 8 revisions

This plugin is intended as an aid to theme and plugin developers.

The purpose of the plugin is to allow arbitrary sorting of terms, similar to pages. This allows queries that fetch terms to use 'menu_order' as a sort order. Here's an example:

$terms = get_terms('category', array( 'orderby' => 'menu_order' ) );

Limiting to specific taxonomies

<?php
/**
 * Limit Term Menu Order to Product Category taxonomy
 *
 * @author Bill Erickson
 * @link https://github.com/billerickson/Term-Menu-Order/wiki/Home/
 *
 * @param array $taxonomies
 * @return array $taxonomies
 */
function be_term_menu_order_taxonomies( $taxonomies ) {

	// You can either use get_taxonomies(), or simulate 
	// the output using array( $key => $value )

	$taxonomies = array( 'product_categories' => 'product_categories' );
	return $taxonomies;
}
add_filter( 'term_menu_order_taxonomies', 'be_term_menu_order_taxonomies' );
Clone this wiki locally