admin管理员组

文章数量:1388868

I have a books custom post type, I want to do something only on the 'book_categories' pages and other stuff on the 'book_year' pages.

How do I check if I'm on those taxonomy pages?

I have a books custom post type, I want to do something only on the 'book_categories' pages and other stuff on the 'book_year' pages.

How do I check if I'm on those taxonomy pages?

Share Improve this question asked Apr 20, 2020 at 15:29 mrKC.988mrKC.988 1072 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

Use is_tax():

if ( is_tax( 'book_categories' ) ) {

}

if ( is_tax( 'book_year' ) ) {

}

本文标签: Check for a specific taxonomy of a custom post type