WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/10/2016 06:40:48 AM (4 years ago)
Author:
westonruter
Message:

Customize: Ensure that wp_setup_nav_menu_item filter applies consistently on nav_menu_item setting values.

The filter was being applied in WP_Customize_Nav_Menu_Item_Setting::value() but not in WP_Customize_Nav_Menu_Item_Setting::value_as_wp_post_nav_menu_item().

Props celloexpressions, westonruter.
Fixes #35203.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menu-item-setting.php

    r36610 r37405  
    767767            'menu_item_parent' => 0,
    768768            'position'         => 2,
    769             'type'             => 'post_type',
     769            'type'             => 'custom_type',
    770770            'title'            => 'Hello \o/ o\'o World',
    771771            'url'              => '',
     
    783783
    784784        $setting->preview();
     785
    785786        $nav_menu_item = $setting->value_as_wp_post_nav_menu_item();
     787        $this->assertEquals( 'Custom Link', $nav_menu_item->type_label );
     788        add_filter( 'wp_setup_nav_menu_item', array( $this, 'filter_type_label' ) );
     789        $nav_menu_item = $setting->value_as_wp_post_nav_menu_item();
     790        $this->assertEquals( 'Custom Label', $nav_menu_item->type_label );
    786791
    787792        $this->assertObjectNotHasAttribute( 'nav_menu_term_id', $nav_menu_item );
Note: See TracChangeset for help on using the changeset viewer.