Answer the question
In order to leave comments, you need to log in
How to check if there is a custom taxonomy created?
Good day, tell me, I want to check if there is a taxonomy 'test' if there is then use its ID if not then create and get its ID
$mainTag = 'test';
$mainTag_srch = get_term_by( 'slug', $mainTag, 'applicationstag' );
if(empty($mainTag_srch)==TRUE){
$mainTag = wp_insert_term($mainTag,'applicationstag');
$mainTag_ID = $mainTag['term_id'];
}else {
$mainTag_ID = $mainTag_srch['term_id'];
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question