Make WordPress Core

Changeset 31140


Ignore:
Timestamp:
01/11/2015 01:25:19 AM (10 years ago)
Author:
boonebgorges
Message:

Default $parent in category_exists() should default to null rather than 0.

[29863] made the corresponding change in term_exists(). Failure to change the
default value in category_exists() meant that an unspecified value for
$parent would limit results to top-level categories.

Includes unit tests and corrected function documentation.

Props hissy.
Fixes #30975 for trunk.

Location:
trunk
Files:
1 added
1 edited

Legend:

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

    r31090 r31140  
    1212
    1313/**
    14  * {@internal Missing Short Description}}
    15  *
    16  * @since 2.0.0
    17  *
    18  * @param int|string $cat_name
    19  * @return int
    20  */
    21 function category_exists($cat_name, $parent = 0) {
     14 * Check whether a category exists.
     15 *
     16 * @since 2.0.0
     17 *
     18 * @see term_exists()
     19 *
     20 * @param int|string $cat_name Category name.
     21 * @param int        $parent   Optional. ID of parent term.
     22 * @return mixed
     23 */
     24function category_exists( $cat_name, $parent = null ) {
    2225    $id = term_exists($cat_name, 'category', $parent);
    2326    if ( is_array($id) )
Note: See TracChangeset for help on using the changeset viewer.