From 83de39a7fb72a8609310a4e87084ba5c85b1a387 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Sat, 18 Mar 2017 03:22:08 +0000 Subject: [PATCH] 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 --- src/wp-includes/theme.php | 2 +- tests/phpunit/tests/customize/manager.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/theme.php b/src/wp-includes/theme.php index bf53205c20..fdf5a34446 100644 --- a/src/wp-includes/theme.php +++ b/src/wp-includes/theme.php @@ -1984,7 +1984,7 @@ function get_theme_starter_content() { 'link_home' => array( 'type' => 'custom', 'title' => _x( 'Home', 'Theme starter content' ), - 'url' => home_url(), + 'url' => home_url( '/' ), ), 'page_home' => array( // Deprecated in favor of link_home. 'type' => 'post_type', diff --git a/tests/phpunit/tests/customize/manager.php b/tests/phpunit/tests/customize/manager.php index 3927ce345c..16d1e4a615 100644 --- a/tests/phpunit/tests/customize/manager.php +++ b/tests/phpunit/tests/customize/manager.php @@ -490,7 +490,7 @@ class Tests_WP_Customize_Manager extends WP_UnitTestCase { $this->assertEquals( -1, $changeset_values['nav_menu_locations[top]'] ); $this->assertEquals( 0, $changeset_values['nav_menu_item[-1]']['object_id'] ); $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->assertNull( $wp_customize->changeset_post_id() );