Docs: Document that `get_category_by_slug()` returns `false` if the category doesn't exist.

Props stevenlinx.
Fixes #50277.
Built from https://develop.svn.wordpress.org/trunk@47863


git-svn-id: http://core.svn.wordpress.org/trunk@47639 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-05-29 10:02:13 +00:00
parent 8924832842
commit bc18c233d6
2 changed files with 3 additions and 2 deletions

View File

@ -175,10 +175,11 @@ function get_category_by_path( $category_path, $full_match = true, $output = OBJ
* @since 2.3.0 * @since 2.3.0
* *
* @param string $slug The category slug. * @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 ) { function get_category_by_slug( $slug ) {
$category = get_term_by( 'slug', $slug, 'category' ); $category = get_term_by( 'slug', $slug, 'category' );
if ( $category ) { if ( $category ) {
_make_cat_compat( $category ); _make_cat_compat( $category );
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.5-alpha-47862'; $wp_version = '5.5-alpha-47863';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.