Make WordPress Core

Ticket #55358: 55358.1.patch

File 55358.1.patch, 1.0 KB (added by lgadzhev, 4 years ago)

An optimized version that avoids duplicate code

  • src/wp-includes/taxonomy.php

    IDEA additional info:
    Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
    <+>UTF-8
    diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
    a b  
    15521552         */
    15531553        $defaults = apply_filters( 'term_exists_default_query_args', $defaults, $term, $taxonomy, $parent );
    15541554
     1555        if ( ! empty( $taxonomy ) && is_numeric( $parent ) ) {
     1556                $defaults['parent'] = (int) $parent;
     1557        }
     1558
    15551559        if ( is_int( $term ) ) {
    15561560                if ( 0 === $term ) {
    15571561                        return 0;
     
    15641568                        return null;
    15651569                }
    15661570
    1567                 if ( ! empty( $taxonomy ) && is_numeric( $parent ) ) {
    1568                         $defaults['parent'] = (int) $parent;
    1569                 }
    1570 
    15711571                $args  = wp_parse_args( array( 'slug' => sanitize_title( $term ) ), $defaults );
    15721572                $terms = get_terms( $args );
    15731573                if ( empty( $terms ) || is_wp_error( $terms ) ) {