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
) );
Related Posts:
- How to create an automatic MultiColoumn MegaMenu with Categories WordPress
- How To Find Out WordPress Category Table in MYSQL?
- Add custom field to Category
- Does the ‘cat’ argument in query_posts fetch posts from subcategories as well as the given ID?
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- Display list of Sub-Categories and the posts they contain, within one main Category
- Create subdomains for tags and categories
- How to get this only in small letters (lowercase)? [closed]
- How to totally get rid of Category in my blog?
- Is there a function to cause empty categories not to show in menus?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Category Specific Archive
- How to add categories to products in woocommerce programatically? [closed]
- Is there a plugin that will completely remove the category system?
- How to get the number of child categories a specific parent category has?
- Removing category base form links messes up the parent-child behavior
- display most popular tags of category?
- How to get only the last child of category slug?
- Exclude category from loop not working
- Multisite – create a category in specific site
- How to list only child categories?
- How do you remove display of WooCommerce product category on single product page?
- Show recent posts in menu?
- Cannot add / edit categories to a post anymore
- List archived posts by subcategory
- What’s the Simplest Way to Override/Rewrite the %category% Permalink Structure Tag?
- Show Different Custom Menu on Different Category Pages
- Convert the default sub-category dashes to bullets or any other characters
- How to check category of of custom post type or not
- Set a them for all subset of category
- How to query post like normal search would do. within search.php page
- How to get the id from the custom category?
- How can i insert term in a specific language of Polylang?
- How to retrieve more posts from a custom post type that are in the same category as the current post
- WordPress Get Posts from each category equally
- Unwanted Duplicate Product Categories in WooCommerce
- WP didn’t redirect to canonical category URL
- Same base for category and post
- Custom taxonomy/category order
- WP admin broken. Not saving catgories or adding categories to menu
- Set colors depending on category
- get_terms function not returning anything
- Why custom taxomony not showing when create a post?
- Getting All Post From Specific category in wpdb
- Single.php Category Post Count
- wp_list_categories with show_count, except for specific categories
- Jigoshop – only displaying 10 products
- Show the amount of posts in a tag in a specific category has
- How to access deleted term inside delete_product_cat action
- How to order get_categories() in the same order as the menu?
- Showing Categories for Page Edit – without plugin
- Difference between wp_list_categories and get_categories
- Show different menu on each woocommerce category page
- How to let the user create a selection of categories via the backend
- Have posts that belong to multiple categories, exclude some categories from homepage
- Display subcategories selectbox on each category page
- How could I write a get_categories_by_year() function?
- How to add icon over specific thumb
- add_settings_field (exclude categories->reading) wp_category_checklist
- Retrieve post tags from from main wp_query
- Listing Post Categories on Home Page
- Get posts in a subcategory of a chosen parent
- How can I only display links from a child category
- Problem with Custom Post Type Categories
- Display post thumbnail for specific category outside the loop
- Category Template – Show Last Entry as Featured
- can I ‘combine’ categories as a menu item?
- List taxonomy terms assigned to a post in hierarchical view
- How to set the same base url for two different taxonomies?
- Hide category name but show posts
- Count how many posts have a specified tag AND category
- Show the parent taxonomy by creating shortcode in woocommerce?
- Post List by category and under custom taxonomy
- Balance Tags to the_content Words Length
- How to create template for children category?
- Using a template page parent breaks page
- Categories and Tags Conflict after Woocommerce Installation
- how to display categories for a specific post?
- Setting category for post as default
- the_content() not showing full posts in category template
- Show parent category if there is no subcategory
- Add category links?
- show posts found in multiple categories via category_name query string?
- foreach,having wp_query inside, breaks after showing one result
- Display a category name automatically using code in the functions.php file
- Removing categories, Comments etc from posts?
- Add html word before category
- Include Category Description in search result
- Problem importing categories and sub-categories
- Category that can hold only specific number of post
- How to add the sidebar in all category page
- how to ask if in two categorys inside if
- How to add a tag above a category post that displays the category name in WordPress
- Woocommerce – Display product category of product in Orders page
- How to show video from wp option value?
- Changing Woocommerce categories programatically
- Add an Exclusive or featured tag line to article titles
- How to list out post category name and description in page
- Print child category slug nicename
- Order Categories by Character Count