WordPress.org

Make WordPress Core

Changeset 47863


Ignore:
Timestamp:
05/29/2020 10:00:32 AM (14 months ago)
Author:
SergeyBiryukov
Message:

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

Props stevenlinx.
Fixes #50277.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/category.php

    r47808 r47863  
    176176 *
    177177 * @param string $slug The category slug.
    178  * @return object Category data object
     178 * @return object|false Category data object on success, false if not found.
    179179 */
    180180function get_category_by_slug( $slug ) {
    181181    $category = get_term_by( 'slug', $slug, 'category' );
     182
    182183    if ( $category ) {
    183184        _make_cat_compat( $category );
Note: See TracChangeset for help on using the changeset viewer.