WP_Customize_Manager::set_changeset_lock() WordPress Method

The WP_Customize_Manager::set_changeset_lock() method is used to lock the changeset for a given WP_Customize_Manager instance. This is typically done when a changeset is first created, and is used to prevent concurrent editing of the changeset.

WP_Customize_Manager::set_changeset_lock( int $changeset_post_id, bool $take_over = false ) #

Marks the changeset post as being currently edited by the current user.


Parameters

$changeset_post_id

(int)(Required)Changeset post ID.

$take_over

(bool)(Optional)Whether to take over the changeset.

Default value: false


Top ↑

Source

File: wp-includes/class-wp-customize-manager.php

	public function set_changeset_lock( $changeset_post_id, $take_over = false ) {
		if ( $changeset_post_id ) {
			$can_override = ! (bool) get_post_meta( $changeset_post_id, '_edit_lock', true );

			if ( $take_over ) {
				$can_override = true;
			}

			if ( $can_override ) {
				$lock = sprintf( '%s:%s', time(), get_current_user_id() );
				update_post_meta( $changeset_post_id, '_edit_lock', $lock );
			} else {
				$this->refresh_changeset_lock( $changeset_post_id );
			}
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More