WP_Customize_Manager::refresh_changeset_lock() WordPress Method

The WP_Customize_Manager::refresh_changeset_lock() method is used to update the changeset lock with the latest changeset data. This is used to ensure that only the most recent changeset data is used when making changes to the Customizer.

WP_Customize_Manager::refresh_changeset_lock( int $changeset_post_id ) #

Refreshes changeset lock with the current time if current user edited the changeset before.


Parameters

$changeset_post_id

(int)(Required)Changeset post ID.


Top ↑

Source

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

	public function refresh_changeset_lock( $changeset_post_id ) {
		if ( ! $changeset_post_id ) {
			return;
		}

		$lock = get_post_meta( $changeset_post_id, '_edit_lock', true );
		$lock = explode( ':', $lock );

		if ( $lock && ! empty( $lock[1] ) ) {
			$user_id         = (int) $lock[1];
			$current_user_id = get_current_user_id();
			if ( $user_id === $current_user_id ) {
				$lock = sprintf( '%s:%s', time(), $user_id );
				update_post_meta( $changeset_post_id, '_edit_lock', $lock );
			}
		}
	}


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