page_cache global variable to cache static pages by their ID. Caching can notably improve performance by retrieving data from memory and avoiding repeated queries to the database. It is an array set in the function
update_page_cache(&$pages) defined in [wordpress root folder]/wp-includes/functions.php.
page_cache internally in the functions to retrieve pages:
get_pages($args = ''): retrieves the static pages according to the arguments provided. Following arguments are supported:
child_of: if specified, the function retrieves the children of specified page ID.
sort_column: attribute of the page that should be used for sorting, which is implemented as column name in the
wp_poststable in the database.
sort_order: order for sorting, currently supports ASC and DESC.
exclude: includes IDs of pages that should be excluded from the retrieval.
get_page_children($page_id, $pages): retrieves child pages of the specified page. If
$pagesargument is empty,
$page_cacheglobal variable is used.
Plugin and theme developers can use
page_cache to write custom functions which involve retrieving page data.
Back to full list of global variables.