WP_Customize_Manager::find_changeset_post_id( string $uuid ): int|null
- Since
- 4.7.0
- Source
wp-includes/class-wp-customize-manager.php:990
Finds the changeset post ID for a given changeset UUID.
Parameters
$uuidstring- Changeset UUID.
Return
int|null- Returns post ID on success and null on failure.
Uses · 5
- wp_cache_get()Retrieves the cache contents from the cache by key and group.
- get_post_type()Retrieves the post type of the current post or of a given post.
- get_post_stati()Gets a list of post statuses.
- wp_cache_set()Saves the data to the cache.
- WP_Query::__construct()Constructor.
Used by · 2
- WP_Customize_Manager::changeset_post_id()Gets the changeset post ID for the loaded changeset.
- WP_Customize_Manager::check_changeset_lock_with_heartbeat()Checks locked changeset with heartbeat API.
Source
public function find_changeset_post_id( $uuid ) { $cache_group = 'customize_changeset_post'; $changeset_post_id = wp_cache_get( $uuid, $cache_group ); if ( $changeset_post_id && 'customize_changeset' === get_post_type( $changeset_post_id ) ) { return $changeset_post_id; } $changeset_post_query = new WP_Query( array( 'post_type' => 'customize_changeset', 'post_status' => get_post_stati(), 'name' => $uuid, 'posts_per_page' => 1, 'no_found_rows' => true, 'cache_results' => true, 'update_post_meta_cache' => false, 'update_post_term_cache' => false, 'lazy_load_term_meta' => false, ) ); if ( ! empty( $changeset_post_query->posts ) ) { // Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed. $changeset_post_id = $changeset_post_query->posts[0]->ID; wp_cache_set( $uuid, $changeset_post_id, $cache_group ); return $changeset_post_id; } return null; }History
Introduced in 4.7.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-includes/class-wp-customize-manager.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.