Ticket #21309: 21309-get_adjacent_post.diff

File 21309-get_adjacent_post.diff, 811 bytes (added by ryan, 9 months ago)
  • wp-includes/link-template.php

     
    11751175        $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort"; 
    11761176        $query_key = 'adjacent_post_' . md5($query); 
    11771177        $result = wp_cache_get($query_key, 'counts'); 
    1178         if ( false !== $result ) 
     1178        if ( false !== $result ) { 
     1179                if ( is_object( $result ) ) 
     1180                        $result = new WP_Post( $result ); 
    11791181                return $result; 
     1182        } 
    11801183 
    11811184        $result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort"); 
    11821185        if ( null === $result ) 
    11831186                $result = ''; 
    11841187 
    11851188        wp_cache_set($query_key, $result, 'counts'); 
     1189 
     1190        if ( is_object( $result ) ) 
     1191                $result = new WP_Post( $result ); 
     1192 
    11861193        return $result; 
    11871194} 
    11881195