Redefine arguments for ‘category’ taxonomy ONLY:
add_filter( 'get_terms_args', 'my_term_args', 10, 2 );
function my_term_args( $args, $taxonomies ) {
// don't affect admin area passing back default arguments
if ( is_admin() ) {
return $args;
}
// check the taxonomy in use and redefine it's default arguments
if( in_array( 'category', $taxonomies ) ) {
$args['orderby'] = 'name';
$args['order'] = 'DESC';
$args['hide_empty'] = false;
}
return $args;
}
Also, get_terms()
syntax you’ve posted is obsolete since version 4.5. The new syntax look like this:
<?php
$categories = get_terms( array(
'taxonomy' => 'category'
'orderby' => 'name',
'order' => 'DESC',
'hide_empty' => false
) );