WordPress.org

Make WordPress Core

Ticket #11435: get_the_title.notice.11435.diff

File get_the_title.notice.11435.diff, 700 bytes (added by filosofo, 6 years ago)
  • wp-includes/post-template.php

     
    106106function get_the_title( $id = 0 ) { 
    107107        $post = &get_post($id); 
    108108 
    109         $title = $post->post_title; 
     109        $title = isset($post->post_title) ? $post->post_title : ''; 
     110        $id = isset($post->ID) ? $post->ID : (int) $id; 
    110111 
    111112        if ( !is_admin() ) { 
    112113                if ( !empty($post->post_password) ) { 
     
    117118                        $title = sprintf($private_title_format, $title); 
    118119                } 
    119120        } 
    120         return apply_filters( 'the_title', $title, $post->ID ); 
     121        return apply_filters( 'the_title', $title, $id ); 
    121122} 
    122123 
    123124/**