WordPress.org

Make WordPress Core

Ticket #5019: 5019.diff

File 5019.diff, 758 bytes (added by mdawaffe, 7 years ago)
  • wp-includes/link-template.php

     
    358358function get_previous_post($in_same_cat = false, $excluded_categories = '') { 
    359359        global $post, $wpdb; 
    360360 
    361         if( !is_single() || is_attachment() ) 
     361        if( empty($post) || !is_single() || is_attachment() ) 
    362362                return null; 
    363363 
    364364        $current_post_date = $post->post_date; 
     
    391391function get_next_post($in_same_cat = false, $excluded_categories = '') { 
    392392        global $post, $wpdb; 
    393393 
    394         if( !is_single() || is_attachment() ) 
     394        if( empty($post) || !is_single() || is_attachment() ) 
    395395                return null; 
    396396 
    397397        $current_post_date = $post->post_date;