Introduce wp_using_ext_object_cache() - mimic wp_suspend_cache_invalidation() and discourage direct access to $_wp_using_ext_object_cache, cleaning up importing of globals in functions and provides function to modify that global. Loads the packaged object cache when an external cache hasn't been loaded or doesn't contain wp_cache_init().
Fixes #21401. Built from https://develop.svn.wordpress.org/trunk@25289 git-svn-id: http://core.svn.wordpress.org/trunk@25253 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -476,8 +476,6 @@ function _is_valid_nav_menu_item( $item ) {
|
||||
* @return mixed $items array of menu items, else false.
|
||||
*/
|
||||
function wp_get_nav_menu_items( $menu, $args = array() ) {
|
||||
global $_wp_using_ext_object_cache;
|
||||
|
||||
$menu = wp_get_nav_menu_object( $menu );
|
||||
|
||||
if ( ! $menu )
|
||||
@@ -504,7 +502,7 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
|
||||
return false;
|
||||
|
||||
// Get all posts and terms at once to prime the caches
|
||||
if ( empty( $fetched[$menu->term_id] ) || $_wp_using_ext_object_cache ) {
|
||||
if ( empty( $fetched[$menu->term_id] ) || wp_using_ext_object_cache() ) {
|
||||
$fetched[$menu->term_id] = true;
|
||||
$posts = array();
|
||||
$terms = array();
|
||||
|
||||
Reference in New Issue
Block a user