WordPress.org

Make WordPress Core

Changeset 12550


Ignore:
Timestamp:
12/27/2009 08:57:33 AM (8 years ago)
Author:
westi
Message:

Fix notices in get_the_title() when passed an invalid id. Also ensure that the filter gets the invalid id so a plugin can supply a default title instead. Fixes #11435 props filosofo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post-template.php

    r12537 r12550  
    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() ) {
     
    118119        }
    119120    }
    120     return apply_filters( 'the_title', $title, $post->ID );
     121    return apply_filters( 'the_title', $title, $id );
    121122}
    122123
Note: See TracChangeset for help on using the changeset viewer.