GC_Customize_Manager::establish_loaded_changeset()
最后更新于:2021-11-27 00:54:28
GC_Customize_Manager::establish_loaded_changeset()Establish the loaded changeset.
源文件
文件: gc-includes/class-gc-customize-manager.php
public function establish_loaded_changeset() {
global $pagenow;
if ( empty( $this->_changeset_uuid ) ) {
$changeset_uuid = null;
if ( ! $this->branching() && $this->is_theme_active() ) {
$unpublished_changeset_posts = $this->get_changeset_posts(
array(
'post_status' => array_diff( get_post_stati(), array( 'auto-draft', 'publish', 'trash', 'inherit', 'private' ) ),
'exclude_restore_dismissed' => false,
'author' => 'any',
'posts_per_page' => 1,
'order' => 'DESC',
'orderby' => 'date',
)
);
$unpublished_changeset_post = array_shift( $unpublished_changeset_posts );
if ( ! empty( $unpublished_changeset_post ) && gc_is_uuid( $unpublished_changeset_post->post_name ) ) {
$changeset_uuid = $unpublished_changeset_post->post_name;
}
}
// If no changeset UUID has been set yet, then generate a new one.
if ( empty( $changeset_uuid ) ) {
$changeset_uuid = gc_generate_uuid4();
}
$this->_changeset_uuid = $changeset_uuid;
}
if ( is_admin() && 'customize.php' === $pagenow ) {
$this->set_changeset_lock( $this->changeset_post_id() );
}
}