Posts, Post Types: Speed cached `get_pages()` calls.
This improves performance for sites with persistent cache backend having a lot of pages requested via the `get_pages() function, by taking advantage of `wp_cache_get_multiple()` instead of fetching each individual page from the backend cache server one by one. It also matches the behaviour of `get_pages()` when the pages are retrieved from the database. Props david.binda, hellofromTonya. Fixes #51469. Built from https://develop.svn.wordpress.org/trunk@51018 git-svn-id: http://core.svn.wordpress.org/trunk@50627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
66603b4bd7
commit
9c0dc03f90
|
@ -5784,10 +5784,13 @@ function get_pages( $args = array() ) {
|
|||
$cache_key = "get_pages:$key:$last_changed";
|
||||
$cache = wp_cache_get( $cache_key, 'posts' );
|
||||
if ( false !== $cache ) {
|
||||
_prime_post_caches( $cache, false, false );
|
||||
|
||||
// Convert to WP_Post instances.
|
||||
$pages = array_map( 'get_post', $cache );
|
||||
/** This filter is documented in wp-includes/post.php */
|
||||
$pages = apply_filters( 'get_pages', $pages, $parsed_args );
|
||||
|
||||
return $pages;
|
||||
}
|
||||
|
||||
|
@ -5948,6 +5951,7 @@ function get_pages( $args = array() ) {
|
|||
|
||||
/** This filter is documented in wp-includes/post.php */
|
||||
$pages = apply_filters( 'get_pages', array(), $parsed_args );
|
||||
|
||||
return $pages;
|
||||
}
|
||||
|
||||
|
@ -7605,7 +7609,7 @@ function _update_term_count_on_transition_post_status( $new_status, $old_status,
|
|||
}
|
||||
|
||||
/**
|
||||
* Adds any posts from the given IDs to the cache that do not already exist in cache
|
||||
* Adds any posts from the given IDs to the cache that do not already exist in cache.
|
||||
*
|
||||
* @since 3.4.0
|
||||
* @access private
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.8-alpha-51017';
|
||||
$wp_version = '5.8-alpha-51018';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue