On this page
wp_cache_get( int|string $key, string $group = '', bool $force = false, bool $found = null ): mixed|false
Retrieves the cache contents from the cache by key and group.
Description
See also
Parameters
$keyint|string Required-
The key under which the cache contents are stored.
$groupstring Optional-
Where the cache contents are grouped.
Default:
'' $forcebool Optional-
Whether to force an update of the local cache from the persistent cache.
Default:
false $foundbool Optional-
Whether the key was found in the cache (passed by reference).
Disambiguates a return of false, a storable value.Default:
null
Return
mixed|false The cache contents on success, false on failure to retrieve contents.
Source
File: wp-includes/cache.php. View all references
function wp_cache_get( $key, $group = '', $force = false, &$found = null ) {
global $wp_object_cache;
return $wp_object_cache->get( $key, $group, $force, $found );
}
Related
Uses
| Uses | Description |
|---|---|
| WP_Object_Cache::get() wp-includes/class-wp-object-cache.php | Retrieves the cache contents, if it exists. |
Used By
| Used By | Description |
|---|---|
| get_metadata_raw() wp-includes/meta.php | Retrieves raw metadata value for the specified object. |
| _find_post_by_old_slug() wp-includes/query.php | Find the post ID for redirecting an old slug. |
| _find_post_by_old_date() wp-includes/query.php | Find the post ID for redirecting an old date. |
| WP_Privacy_Requests_Table::get_request_counts() wp-admin/includes/class-wp-privacy-requests-table.php | Count number of requests for each status. |
| WP_Embed::find_oembed_post_id() wp-includes/class-wp-embed.php | Finds the oEmbed cache post ID for a given cache key. |
| WP_Customize_Manager::find_changeset_post_id() wp-includes/class-wp-customize-manager.php | Finds the changeset post ID for a given changeset UUID. |
| wp_cache_get_last_changed() wp-includes/functions.php | Gets last changed date for the specified cache group. |
| WP_Term_Query::get_terms() wp-includes/class-wp-term-query.php | Retrieves the query results. |
| WP_Network_Query::get_networks() wp-includes/class-wp-network-query.php | Gets a list of networks matching the query vars. |
| WP_Site::get_details() wp-includes/class-wp-site.php | Retrieves the details for this site. |
| ms_load_current_site_and_network() wp-includes/ms-load.php | Identifies the network and site of a requested domain and path and populates the corresponding network and site global objects as part of the multisite bootstrap process. |
| WP_Site_Query::get_sites() wp-includes/class-wp-site-query.php | Retrieves a list of sites matching the query vars. |
| WP_Site::get_instance() wp-includes/class-wp-site.php | Retrieves a site from the database by its ID. |
| WP_Network::get_instance() wp-includes/class-wp-network.php | Retrieves a network from the database by its ID. |
| WP_Comment::get_instance() wp-includes/class-wp-comment.php | Retrieves a WP_Comment instance. |
| WP_Comment_Query::fill_descendants() wp-includes/class-wp-comment-query.php | Fetch descendants for located comments. |
| WP_Term::get_instance() wp-includes/class-wp-term.php | Retrieve WP_Term instance. |
| update_network_option() wp-includes/option.php | Updates the value of a network option that was already added. |
| add_network_option() wp-includes/option.php | Adds a new network option. |
| get_network_option() wp-includes/option.php | Retrieves a network’s option value based on the option name. |
| WP_MS_Sites_List_Table::column_users() wp-admin/includes/class-wp-ms-sites-list-table.php | Handles the users column output. |
| WP_Comment_Query::get_comments() wp-includes/class-wp-comment-query.php | Get a list of comments matching the query vars. |
| get_plugins() wp-admin/includes/plugin.php | Checks the plugins directory and retrieve all plugin files with plugin data. |
| WP_User::get_data_by() wp-includes/class-wp-user.php | Returns only the main user fields. |
| wp_get_archives() wp-includes/general-template.php | Displays archive links based on type and format. |
| get_calendar() wp-includes/general-template.php | Displays calendar with days that have posts as links. |
| get_usermeta() wp-includes/deprecated.php | Retrieve user metadata. |
| WP_Theme::cache_get() wp-includes/class-wp-theme.php | Gets theme data from cache. |
| WP_Query::get_posts() wp-includes/class-wp-query.php | Retrieves an array of posts based on query variables. |
| is_blog_installed() wp-includes/functions.php | Determines whether WordPress is already installed. |
| get_object_term_cache() wp-includes/taxonomy.php | Retrieves the cached term objects for the given object ID. |
| get_objects_in_term() wp-includes/taxonomy.php | Retrieves object IDs of valid taxonomy and term. |
| get_adjacent_post() wp-includes/link-template.php | Retrieves the adjacent post. |
| get_site_transient() wp-includes/option.php | Retrieves the value of a site transient. |
| get_transient() wp-includes/option.php | Retrieves the value of a transient. |
| wp_load_alloptions() wp-includes/option.php | Loads and caches all autoloaded options, if available or all options. |
| update_option() wp-includes/option.php | Updates the value of an option that was already added. |
| add_option() wp-includes/option.php | Adds a new option. |
| get_option() wp-includes/option.php | Retrieves an option value based on an option name. |
| WP_Post::get_instance() wp-includes/class-wp-post.php | Retrieve WP_Post instance. |
| wp_mime_type_icon() wp-includes/post.php | Retrieves the icon for a MIME type or attachment. |
| _get_last_post_time() wp-includes/post.php | Gets the timestamp of the last time any post was modified or published. |
| get_all_page_ids() wp-includes/post.php | Gets a list of page IDs. |
| get_page_by_path() wp-includes/post.php | Retrieves a page given its path. |
| get_pages() wp-includes/post.php | Retrieves an array of pages (or hierarchical post type items). |
| wp_count_posts() wp-includes/post.php | Counts number of posts of a post type and if user has permissions to view. |
| wp_count_attachments() wp-includes/post.php | Counts number of attachments for the mime type(s). |
| get_blog_id_from_url() wp-includes/ms-functions.php | Gets a blog’s numeric ID from its URL. |
| get_bookmark() wp-includes/bookmark.php | Retrieves bookmark data. |
| get_bookmarks() wp-includes/bookmark.php | Retrieves the list of bookmarks. |
| get_blog_details() wp-includes/ms-blogs.php | Retrieve the details for a blog from the blogs table and blog options. |
| wp_count_comments() wp-includes/comment.php | Retrieves the total comment counts for the whole site or a single post. |
| get_lastcommentmodified() wp-includes/comment.php | Retrieves the date the last comment was modified. |
| metadata_exists() wp-includes/meta.php | Determines if a meta field with the given key exists for the given object ID. |
Changelog
| Version | Description |
|---|---|
| 2.0.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/wp_cache_get