From 62483f026885eedec372f2852d22368ec30e5045 Mon Sep 17 00:00:00 2001 From: Ryan Kienstra Date: Fri, 18 May 2018 12:40:51 -0500 Subject: [PATCH] Pass '/' as an argument to home_url(), preventing possible 404. In response to a support topic, where the link wrapping the home logo in legacy templating lead to a 404 page. According to the documentation for home_url(), passing the '/' argument is the default usage. @see https://wordpress.org/support/topic/need-to-add-slash-to-end-of-url/#post-10293713 --- includes/templates/class-amp-post-template.php | 2 +- readme.md | 1 + readme.txt | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/templates/class-amp-post-template.php b/includes/templates/class-amp-post-template.php index f80b9564931..f76d573b287 100644 --- a/includes/templates/class-amp-post-template.php +++ b/includes/templates/class-amp-post-template.php @@ -113,7 +113,7 @@ public function __construct( $post ) { 'document_title' => function_exists( 'wp_get_document_title' ) ? wp_get_document_title() : wp_title( '', false ), // Back-compat with 4.3. 'canonical_url' => get_permalink( $this->ID ), - 'home_url' => home_url(), + 'home_url' => home_url( '/' ), 'blog_name' => get_bloginfo( 'name' ), 'html_tag_attributes' => array(), diff --git a/readme.md b/readme.md index fe52732b44e..e9dd08085bf 100644 --- a/readme.md +++ b/readme.md @@ -68,6 +68,7 @@ Follow along with or [contribute](https://github.com/Automattic/amp-wp/blob/deve - Ensure before/after is amended to filtered comment_reply_link. See [#1118](https://github.com/Automattic/amp-wp/pull/1118). Props westonruter. - Force VideoPress to use html5 player for AMP. See [#1125](https://github.com/Automattic/amp-wp/pull/1125). Props yurynix. - Soft-deprecate `AMP_Base_Sanitizer::get_body_node()` instead of hard-deprecating it (with triggered notice). See [#1141](https://github.com/Automattic/amp-wp/pull/1141). Props westonruter. +- Pass '/' as an argument to home_url(), preventing possible 404. See [#1158](https://github.com/Automattic/amp-wp/issues/1158), [#1161](https://github.com/Automattic/amp-wp/pull/1161). Props kienstra. See [0.7.1 milestone](https://github.com/Automattic/amp-wp/milestone/8?closed=1). diff --git a/readme.txt b/readme.txt index a2b76e3d205..5733d46547a 100644 --- a/readme.txt +++ b/readme.txt @@ -50,6 +50,7 @@ Follow along with or [contribute](https://github.com/Automattic/amp-wp/blob/deve - Ensure before/after is amended to filtered comment_reply_link. See [#1118](https://github.com/Automattic/amp-wp/pull/1118). Props westonruter. - Force VideoPress to use html5 player for AMP. See [#1125](https://github.com/Automattic/amp-wp/pull/1125). Props yurynix. - Soft-deprecate `AMP_Base_Sanitizer::get_body_node()` instead of hard-deprecating it (with triggered notice). See [#1141](https://github.com/Automattic/amp-wp/pull/1141). Props westonruter. +- Pass '/' as an argument to home_url(), preventing possible 404. See [#1158](https://github.com/Automattic/amp-wp/issues/1158), [#1161](https://github.com/Automattic/amp-wp/pull/1161). Props kienstra. See [0.7.1 milestone](https://github.com/Automattic/amp-wp/milestone/8?closed=1).