WordPress.org

Make WordPress Core

Ticket #21760: 21760.11.patch

File 21760.11.patch, 560 bytes (added by sstoqnov, 4 years ago)

Return false if the term value is empty

  • wp-includes/taxonomy.php

     
    831831function get_term_by( $field, $value, $taxonomy = '', $output = OBJECT, $filter = 'raw' ) {
    832832
    833833        // 'term_taxonomy_id' lookups don't require taxonomy checks.
    834         if ( 'term_taxonomy_id' !== $field && ! taxonomy_exists( $taxonomy ) ) {
     834        if ( 'term_taxonomy_id' !== $field && ! taxonomy_exists( $taxonomy ) || empty( $value ) ) {
    835835                return false;
    836836        }
    837837