From 72d9177fc0102c52aeb387f963cbbc54d69cbfa8 Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 16 Dec 2016 05:41:34 +0000 Subject: [PATCH] Posts, Post Types: Ensure `is_page_template()` can only return true when viewing a singular post query. Props natereist, dlh, johnbillion. Merges [39599] to the 4.7 branch. Fixes #39211. Built from https://develop.svn.wordpress.org/branches/4.7@39608 git-svn-id: http://core.svn.wordpress.org/branches/4.7@39548 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index ac8864334a..701af8de4a 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1631,6 +1631,10 @@ function get_the_password_form( $post = 0 ) { * @return bool True on success, false on failure. */ function is_page_template( $template = '' ) { + if ( ! is_singular() ) { + return false; + } + $page_template = get_page_template_slug( get_queried_object_id() ); if ( empty( $template ) ) diff --git a/wp-includes/version.php b/wp-includes/version.php index fbebe0c16b..3a03014bc8 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.7.1-alpha-39607'; +$wp_version = '4.7.1-alpha-39608'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.