Definition:
function get_cat_ID( $cat_name='General' ) {}
Retrieve the ID of a category from its name.
Parameters
- string $cat_name: Optional. Default is ‘General’ and can be any category name.
Return values
returns:0, if failure and ID of category on success.
Source code
function get_cat_ID( $cat_name='General' ) { $cat = get_term_by( 'name', $cat_name, 'category' ); if ( $cat ) return $cat->term_id; return 0; }
1264
No comments yet... Be the first to leave a reply!