Make WordPress Core

Ticket #17034: 28572.diff

File 28572.diff, 456 bytes (added by UmeshSingla, 11 years ago)

Fixes get_the_ID() if get_post() returns null

  • wp-includes/post-template.php

     
    2323 * @since 2.1.0
    2424 * @uses $post
    2525 *
    26  * @return int
     26 * @return int the ID of the current item
    2727 */
    2828function get_the_ID() {
    29         return get_post()->ID;
     29        $post = get_post();
     30        return !empty ( $post ) ? $post->ID : false ;
    3031}
    3132
    3233/**