[wp-hackers] if category exists

Daniel Cameron dan at sproutventure.com
Mon Mar 23 19:33:51 GMT 2009


>
> If you're in the admin area you can use the following conditional:
> if ( category_exists('category_name') ) { ... }
>
> If you're not in the admin, you just have to reference is_term:
> if ( is_term( 'category_name' , 'category' ) ) { ... }
>
> In the second example, "category" needs to remain category, but
> category_term is the title of the category your checking for.
>

Thanks Glen,
This worked perfect.


More information about the wp-hackers mailing list