Make WordPress Core


Ignore:
Timestamp:
08/08/2016 01:13:56 PM (8 years ago)
Author:
ocean90
Message:

Taxononmy: Set WP_Term_Query::terms when returning terms from the cache in WP_Term_Query::get_terms().

Merge of [38211] and [38212] to the 4.6 branch.

Props wonderboymusic.
Props boonebgorges for review.
Fixes #37591.

Location:
branches/4.6
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.6

  • branches/4.6/tests/phpunit/tests/term/query.php

    r38182 r38214  
    143143        return $clauses;
    144144    }
     145
     146    /**
     147     * @ticket 37591
     148     */
     149    public function test_terms_is_set() {
     150        register_taxonomy( 'wptests_tax_1', 'post' );
     151
     152        self::factory()->term->create( array( 'taxonomy' => 'wptests_tax_1' ) );
     153
     154        $q1 = new WP_Term_Query( array(
     155            'taxonomy' => 'wptests_tax_1',
     156            'hide_empty' => false
     157        ) );
     158
     159        $this->assertNotEmpty( $q1->terms );
     160
     161        $q2 = new WP_Term_Query( array(
     162            'taxonomy' => 'wptests_tax_1',
     163            'hide_empty' => false
     164        ) );
     165
     166        $this->assertNotEmpty( $q2->terms );
     167    }
    145168}
Note: See TracChangeset for help on using the changeset viewer.