WordPress.org

Make WordPress Core

Ticket #18120: 18120.diff

File 18120.diff, 1.4 KB (added by nacin, 6 years ago)
  • wp-includes/link-template.php

     
    11661166        $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories );
    11671167        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" );
    11681168
    1169         $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";
     1169        $query = "SELECT p.id FROM $wpdb->posts AS p $join $where $sort";
    11701170        $query_key = 'adjacent_post_' . md5($query);
    11711171        $result = wp_cache_get($query_key, 'counts');
    11721172        if ( false !== $result ) {
    1173                 if ( is_object( $result ) )
    1174                         $result = new WP_Post( $result );
     1173                if ( $result )
     1174                        $result = get_post( $result );
    11751175                return $result;
    11761176        }
    11771177
    1178         $result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
     1178        $result = $wpdb->get_var( $query );
    11791179        if ( null === $result )
    11801180                $result = '';
    11811181
    11821182        wp_cache_set($query_key, $result, 'counts');
    11831183
    1184         if ( is_object( $result ) )
    1185                 $result = new WP_Post( $result );
     1184        if ( $result )
     1185                $result = get_post( $result );
    11861186
    11871187        return $result;
    11881188}
     
    20572057        else
    20582058                $url = WP_PLUGIN_URL;
    20592059
    2060        
     2060
    20612061        $url = set_url_scheme( $url );
    20622062
    20632063        if ( !empty($plugin) && is_string($plugin) ) {