WordPress.org

Make WordPress Core

Ticket #24250: 24250.diff

File 24250.diff, 944 bytes (added by tollmanz, 5 years ago)
  • wp-includes/post-template.php

     
    12751275 *
    12761276 * @since 3.4.0
    12771277 *
    1278  * @param int $post_id The page ID to check. Defaults to the current post, when used in the loop.
     1278 * @param int|null $post_id The page ID to check. Defaults to the current post, when used in the loop.
    12791279 * @return string|bool Page template filename. Returns an empty string when the default page template
    12801280 *      is in use. Returns false if the post is not a page.
    12811281 */
    12821282function get_page_template_slug( $post_id = null ) {
    12831283        $post = get_post( $post_id );
    1284         if ( 'page' != $post->post_type )
     1284        if ( ! isset( $post->post_type ) || 'page' != $post->post_type )
    12851285                return false;
    12861286        $template = get_post_meta( $post->ID, '_wp_page_template', true );
    12871287        if ( ! $template || 'default' == $template )