Posts, Post Types: Ensure `is_page_template()` can only return true when viewing a singular post query.

Props natereist, dlh
Fixes #39211

Built from https://develop.svn.wordpress.org/trunk@39599


git-svn-id: http://core.svn.wordpress.org/trunk@39539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
John Blackbourn 2016-12-14 03:43:43 +00:00
parent 505e135f4c
commit efa99585e3
2 changed files with 5 additions and 1 deletions

View File

@ -1631,6 +1631,10 @@ function get_the_password_form( $post = 0 ) {
* @return bool True on success, false on failure. * @return bool True on success, false on failure.
*/ */
function is_page_template( $template = '' ) { function is_page_template( $template = '' ) {
if ( ! is_singular() ) {
return false;
}
$page_template = get_page_template_slug( get_queried_object_id() ); $page_template = get_page_template_slug( get_queried_object_id() );
if ( empty( $template ) ) if ( empty( $template ) )

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.8-alpha-39598'; $wp_version = '4.8-alpha-39599';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.