From 0133a78dec568498c8824ecfa0b0f1745680ade8 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Fri, 29 May 2020 10:00:32 +0000 Subject: [PATCH] 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 --- src/wp-includes/category.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/wp-includes/category.php b/src/wp-includes/category.php index 42ac6227f3..e6bfe75d5f 100644 --- a/src/wp-includes/category.php +++ b/src/wp-includes/category.php @@ -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 ); }