mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Return WP_Post from get_adjacent_post(). see #21309
git-svn-id: https://develop.svn.wordpress.org/trunk@21627 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -1175,14 +1175,21 @@ function get_adjacent_post( $in_same_cat = false, $excluded_categories = '', $pr
|
||||
$query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort";
|
||||
$query_key = 'adjacent_post_' . md5($query);
|
||||
$result = wp_cache_get($query_key, 'counts');
|
||||
if ( false !== $result )
|
||||
if ( false !== $result ) {
|
||||
if ( is_object( $result ) )
|
||||
$result = new WP_Post( $result );
|
||||
return $result;
|
||||
}
|
||||
|
||||
$result = $wpdb->get_row("SELECT p.* FROM $wpdb->posts AS p $join $where $sort");
|
||||
if ( null === $result )
|
||||
$result = '';
|
||||
|
||||
wp_cache_set($query_key, $result, 'counts');
|
||||
|
||||
if ( is_object( $result ) )
|
||||
$result = new WP_Post( $result );
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user