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
This commit is contained in:
Dion Hulse 2016-12-16 05:41:34 +00:00
parent b24993e4cd
commit 72d9177fc0
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.
*/
function is_page_template( $template = '' ) {
if ( ! is_singular() ) {
return false;
}
$page_template = get_page_template_slug( get_queried_object_id() );
if ( empty( $template ) )

View File

@ -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.