WordPress.org

Make WordPress Core

Ticket #21606: taxonomy.php.patch

File taxonomy.php.patch, 1.2 KB (added by barrykooij, 20 months ago)

Taxonomy Patch

  • wp-includes/taxonomy.php

     
    14611461 * @param int|string $term The term to check 
    14621462 * @param string $taxonomy The taxonomy name to use 
    14631463 * @param int $parent ID of parent term under which to confine the exists search. 
    1464  * @return mixed Returns 0 if the term does not exist. Returns the term ID if no taxonomy is specified 
     1464 * @return mixed Returns null if the term does not exist. Returns the term ID if no taxonomy is specified 
    14651465 *      and the term ID exists. Returns an array of the term ID and the taxonomy if the pairing exists. 
    14661466 */ 
    14671467function term_exists($term, $taxonomy = '', $parent = 0) { 
     
    14721472 
    14731473        if ( is_int($term) ) { 
    14741474                if ( 0 == $term ) 
    1475                         return 0; 
     1475                        return null; 
    14761476                $where = 't.term_id = %d'; 
    14771477                if ( !empty($taxonomy) ) 
    14781478                        return $wpdb->get_row( $wpdb->prepare( $tax_select . $where . " AND tt.taxonomy = %s", $term, $taxonomy ), ARRAY_A ); 
     
    14831483        $term = trim( stripslashes( $term ) ); 
    14841484 
    14851485        if ( '' === $slug = sanitize_title($term) ) 
    1486                 return 0; 
     1486                return null; 
    14871487 
    14881488        $where = 't.slug = %s'; 
    14891489        $else_where = 't.name = %s';