Make WordPress Core


Ignore:
Timestamp:
07/08/2015 08:17:52 PM (9 years ago)
Author:
westonruter
Message:

Customizer: Prevent loss of walker and fallback_cb args for wp_nav_menu.

These args only need to be cleared out when exported to JavaScript, when they are not JSON-serializable. So the filter now clears these when gathering args for exporting to JS, but otherwise now leaves the original values to be passed through to wp_nav_menu().

Fixes #32781.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/customize/nav-menus.php

    r33089 r33131  
    359359        $expected = array(
    360360            'echo',
    361             'args_hash',
    362361            'can_partial_refresh',
    363362            'fallback_cb',
     
    371370        ) );
    372371        $this->assertEqualSets( $expected, array_keys( $results ) );
    373         $this->assertEquals( '', $results['fallback_cb'] );
    374         $this->assertEquals( '', $results['walker'] );
     372        $this->assertEquals( 'wp_page_menu', $results['fallback_cb'] );
    375373        $this->assertEquals( 0, $results['can_partial_refresh'] );
     374
     375        $this->assertNotEmpty( $menus->preview_nav_menu_instance_args[ $results['instance_number'] ] );
     376        $preview_nav_menu_instance_args = $menus->preview_nav_menu_instance_args[ $results['instance_number'] ];
     377        $this->assertEquals( '', $preview_nav_menu_instance_args['fallback_cb'] );
     378        $this->assertEquals( '', $preview_nav_menu_instance_args['walker'] );
     379        $this->assertNotEmpty( $preview_nav_menu_instance_args['args_hash'] );
    376380    }
    377381
Note: See TracChangeset for help on using the changeset viewer.