I Am trying to sort my custom post categories according to its description. I tried below args
but it did not work
$taxonomies = array(
'post_tag',
'product-type',
);
// Add the slugs of product types that should appear on the page
$slugs = array(
'hand-tools',
'mechanical-tools',
'abrasive-wheel',
'garden-tools',
'screens',
'locks'
);
$args = array(
'orderby' => 'description',
'order' => 'DESC',
'hide_empty' => false,
'exclude' => array(),
'exclude_tree' => array(),
'include' => array(),
'number' => $number,
'fields' => 'all',
'slug' => $slugs,
'parent' => 0,
'hierarchical' => true,
'childless' => false,
'get' => '',
'name__like' => '',
'description__like' => '',
'pad_counts' => false,
'offset' => $offset,
'search' => '',
'cache_domain' => 'core'
);
I Am trying to sort my custom post categories according to its description. I tried below args
but it did not work
$taxonomies = array(
'post_tag',
'product-type',
);
// Add the slugs of product types that should appear on the page
$slugs = array(
'hand-tools',
'mechanical-tools',
'abrasive-wheel',
'garden-tools',
'screens',
'locks'
);
$args = array(
'orderby' => 'description',
'order' => 'DESC',
'hide_empty' => false,
'exclude' => array(),
'exclude_tree' => array(),
'include' => array(),
'number' => $number,
'fields' => 'all',
'slug' => $slugs,
'parent' => 0,
'hierarchical' => true,
'childless' => false,
'get' => '',
'name__like' => '',
'description__like' => '',
'pad_counts' => false,
'offset' => $offset,
'search' => '',
'cache_domain' => 'core'
);
You can add custom order fields I suppose as well.
$categories = get_categories( array(
'orderby' => 'description',
'order' => 'ASC'
) );