From 13adb37ce1d2d36bbd6c7e08ab74cd4226ff4cb1 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 7 May 2013 18:44:22 +0000 Subject: [PATCH] Avoid a PHP notice in get_page_template_slug() if the page does not exist. props tollmanz. fixes #24250. git-svn-id: http://core.svn.wordpress.org/trunk@24191 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/post-template.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wp-includes/post-template.php b/wp-includes/post-template.php index 2e5731c32e..04f19fcdb4 100644 --- a/wp-includes/post-template.php +++ b/wp-includes/post-template.php @@ -1275,13 +1275,13 @@ function is_page_template( $template = '' ) { * * @since 3.4.0 * - * @param int $post_id The page ID to check. Defaults to the current post, when used in the loop. + * @param int $post_id Optional. The page ID to check. Defaults to the current post, when used in the loop. * @return string|bool Page template filename. Returns an empty string when the default page template * is in use. Returns false if the post is not a page. */ function get_page_template_slug( $post_id = null ) { $post = get_post( $post_id ); - if ( 'page' != $post->post_type ) + if ( ! $post || 'page' != $post->post_type ) return false; $template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( ! $template || 'default' == $template )