WordPress.org

Make WordPress Core

Changeset 40083


Ignore:
Timestamp:
02/20/17 06:15:07 (3 months ago)
Author:
dd32
Message:

Taxonomy: Disallow overriding the name property when registering a taxonomy.

Props wpfo for initial patch, swissspidy.
Merges [40049] to the 4.7 branch.
Fixes #39308.

Location:
branches/4.7
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/4.7

  • branches/4.7/src/wp-includes/class-wp-taxonomy.php

    r38747 r40083  
    334334        } 
    335335 
     336        $args['name'] = $this->name; 
     337 
    336338        foreach ( $args as $property_name => $property_value ) { 
    337339            $this->$property_name = $property_value; 
  • branches/4.7/tests/phpunit/tests/taxonomy.php

    r38571 r40083  
    711711    } 
    712712 
     713    /** 
     714     * @ticket 39308 
     715     */ 
     716    public function test_taxonomy_name_property_should_not_get_overridden_by_passed_args() { 
     717        register_taxonomy( 'foo', 'post', array( 'name' => 'bar' ) ); 
     718 
     719        $taxonomy = get_taxonomy( 'foo' ); 
     720        unregister_taxonomy( 'foo' ); 
     721 
     722        $this->assertSame( 'foo', $taxonomy->name ); 
     723    } 
    713724} 
Note: See TracChangeset for help on using the changeset viewer.