get_cat_ID( string $cat_name )
Retrieve the ID of a category from its name.
Parameters
- $cat_name
-
(Required) Category name.
Return
(int) 0, if failure and ID of category on success.
Source
File: wp-includes/category.php
function get_cat_ID( $cat_name ) {
$cat = get_term_by( 'name', $cat_name, 'category' );
if ( $cat )
return $cat->term_id;
return 0;
}
Changelog
Version | Description |
---|---|
WP-1.0.0 | Introduced. |