mirror of
https://github.com/WordPress/WordPress.git
synced 2025-02-22 06:29:30 +00:00
Return WP_Post from get_adjacent_post(). see #21309
git-svn-id: http://core.svn.wordpress.org/trunk@21627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
afd493abe9
commit
af91b41af3
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user