Customize: Trailingslash the home nav menu item URL in starter content.

This prevents an additional 301 redirect when clicking on the nav menu item, and it also prevents a scenario where the auth cookie may not be passed and cause an authentication error when navigating in the customizer.

Props dlh, swissspidy.
Fixes #40112.


git-svn-id: https://develop.svn.wordpress.org/trunk@40300 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-03-18 03:22:08 +00:00
parent d98ee0cd18
commit 83de39a7fb
2 changed files with 2 additions and 2 deletions

View File

@ -1984,7 +1984,7 @@ function get_theme_starter_content() {
'link_home' => array( 'link_home' => array(
'type' => 'custom', 'type' => 'custom',
'title' => _x( 'Home', 'Theme starter content' ), 'title' => _x( 'Home', 'Theme starter content' ),
'url' => home_url(), 'url' => home_url( '/' ),
), ),
'page_home' => array( // Deprecated in favor of link_home. 'page_home' => array( // Deprecated in favor of link_home.
'type' => 'post_type', 'type' => 'post_type',

View File

@ -490,7 +490,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase {
$this->assertEquals( -1, $changeset_values['nav_menu_locations[top]'] ); $this->assertEquals( -1, $changeset_values['nav_menu_locations[top]'] );
$this->assertEquals( 0, $changeset_values['nav_menu_item[-1]']['object_id'] ); $this->assertEquals( 0, $changeset_values['nav_menu_item[-1]']['object_id'] );
$this->assertEquals( 'custom', $changeset_values['nav_menu_item[-1]']['type'] ); $this->assertEquals( 'custom', $changeset_values['nav_menu_item[-1]']['type'] );
$this->assertEquals( home_url(), $changeset_values['nav_menu_item[-1]']['url'] ); $this->assertEquals( home_url( '/' ), $changeset_values['nav_menu_item[-1]']['url'] );
$this->assertEmpty( $wp_customize->changeset_data() ); $this->assertEmpty( $wp_customize->changeset_data() );
$this->assertNull( $wp_customize->changeset_post_id() ); $this->assertNull( $wp_customize->changeset_post_id() );