WordPress.org

Make WordPress Core

Changeset 31376


Ignore:
Timestamp:
02/09/2015 02:21:26 AM (7 years ago)
Author:
dd32
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.
Merges [31140] to the 4.1 branch.
Fixes #30975.

Location:
branches/4.1
Files:
2 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/4.1

  • branches/4.1/src/wp-admin/includes/taxonomy.php

    r30197 r31376  
    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.