Uses
Uses | Description |
---|---|
wp-includes/category.php: _make_cat_compat() | Updates category structure to old pre-2.3 from new taxonomy structure. |
wp-includes/taxonomy.php: get_term_by() | Get all Term data from database by Term field and data. |
Retrieves a category object by category slug.
(string) (Required) The category slug.
(object|false) Category data object on success, false if not found.
Same is achieved by:
get_term_by('slug', $slug, 'category');
File: wp-includes/category.php
function get_category_by_slug( $slug ) { $category = get_term_by( 'slug', $slug, 'category' ); if ( $category ) { _make_cat_compat( $category ); } return $category; }
Version | Description |
---|---|
2.3.0 | Introduced. |
© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/get_category_by_slug