Nayeem Hyder Riddhi
Nayeem Hyder Riddhi

Reputation: 611

How can i show all taxonomies of WP for categories and tags only?

I am trying here with this code,

$all_terms = get_object_taxonomies(get_post_types(array('public'   => true ), 'names', 'and' ));

but it is rendering the post_format, other types like product_visibility too, but I want only tags and categories, is there any function or process that i can get only tags and categories

Upvotes: 0

Views: 129

Answers (1)

Bhautik
Bhautik

Reputation: 11282

You can use get_terms() check the below code.

For Tag.

$post_tag = get_terms( array(
    'taxonomy' => 'post_tag',
    'hide_empty' => false,
) );

For category.

$category = get_terms( array(
    'taxonomy' => 'category',
    'hide_empty' => false,
) );

Upvotes: 1

Related Questions