Docs: Document that get_category_by_slug()
returns false
if the category doesn't exist.
Props stevenlinx. Fixes #50277. git-svn-id: https://develop.svn.wordpress.org/trunk@47863 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
7f73f1a1e4
commit
0133a78dec
@ -175,10 +175,11 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
|
||||
* @since 2.3.0
|
||||
*
|
||||
* @param string $slug The category slug.
|
||||
* @return object Category data object
|
||||
* @return object|false Category data object on success, false if not found.
|
||||
*/
|
||||
function get_category_by_slug( $slug ) {
|
||||
$category = get_term_by( 'slug', $slug, 'category' );
|
||||
|
||||
if ( $category ) {
|
||||
_make_cat_compat( $category );
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user