WP_Customize_Manager::changeset_data(): array
- Since
- 4.7.0, 4.9.0
- Source
wp-includes/class-wp-customize-manager.php:1156
Gets changeset data.
Return
array- Changeset data.
Uses · 7
- is_user_logged_in()Determines whether the current visitor is a logged in user.
- wp_get_post_autosave()Retrieves the autosaved data of the specified post.
- get_current_user_id()Gets the current user's ID.
- is_wp_error()Checks whether the given variable is a WordPress Error.
- WP_Customize_Manager::changeset_post_id()Gets the changeset post ID for the loaded changeset.
- WP_Customize_Manager::autosaved()Gets whether data from a changeset's autosaved revision should be loaded if it exists.
- WP_Customize_Manager::get_changeset_post_data()Gets the data stored in a changeset post.
Used by · 1
- WP_Customize_Manager::unsanitized_post_values()Gets dirty pre-sanitized setting values in the current customized state.
Source
public function changeset_data() { if ( isset( $this->_changeset_data ) ) { return $this->_changeset_data; } $changeset_post_id = $this->changeset_post_id(); if ( ! $changeset_post_id ) { $this->_changeset_data = array(); } else { if ( $this->autosaved() && is_user_logged_in() ) { $autosave_post = wp_get_post_autosave( $changeset_post_id, get_current_user_id() ); if ( $autosave_post ) { $data = $this->get_changeset_post_data( $autosave_post->ID ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } } } // Load data from the changeset if it was not loaded from an autosave. if ( ! isset( $this->_changeset_data ) ) { $data = $this->get_changeset_post_data( $changeset_post_id ); if ( ! is_wp_error( $data ) ) { $this->_changeset_data = $data; } else { $this->_changeset_data = array(); } } } return $this->_changeset_data; }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.
4.9.0
This will return the changeset's data with a user's autosave revision merged on top, if one exists and $autosaved is true.from the docblock
4.7.0
Introduced.from the docblock
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.