Make WordPress Core

Ticket #42361: 42361.diff

File 42361.diff, 753 bytes (added by socki03, 6 years ago)

Move if $_term is false to after the filters are run.

  • src/wp-includes/taxonomy.php

     
    767767
    768768        if ( is_wp_error( $_term ) ) {
    769769                return $_term;
    770         } elseif ( ! $_term ) {
    771                 return null;
    772770        }
    773771
    774772        /**
     
    796794         */
    797795        $_term = apply_filters( "get_{$taxonomy}", $_term, $taxonomy );
    798796
     797        // If `$_term` doesn't exist by now bail with null.
     798        if ( ! $_term ) {
     799                return null;
     800        }
     801
    799802        // Bail if a filter callback has changed the type of the `$_term` object.
    800803        if ( ! ( $_term instanceof WP_Term ) ) {
    801804                return $_term;
    802         }
     805        } 
    803806
    804807        // Sanitize term, according to the specified filter.
    805808        $_term->filter( $filter );