WP_Customize_Manager::handle_override_changeset_lock_request()

Removes changeset lock when take over request is sent via Ajax.


Description Description


Source Source

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

	public function handle_override_changeset_lock_request() {
		if ( ! $this->is_preview() ) {
			wp_send_json_error( 'not_preview', 400 );
		}

		if ( ! check_ajax_referer( 'customize_override_changeset_lock', 'nonce', false ) ) {
			wp_send_json_error( array(
				'code' => 'invalid_nonce',
				'message' => __( 'Security check failed.' ),
			) );
		}

		$changeset_post_id = $this->changeset_post_id();

		if ( empty( $changeset_post_id ) ) {
			wp_send_json_error( array(
				'code' => 'no_changeset_found_to_take_over',
				'message' => __( 'No changeset found to take over' ),
			) );
		}

		if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post_id ) ) {
			wp_send_json_error( array(
				'code' => 'cannot_remove_changeset_lock',
				'message' => __( 'Sorry, you are not allowed to take over.' ),
			) );
		}

		$this->set_changeset_lock( $changeset_post_id, true );

		wp_send_json_success( 'changeset_taken_over' );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
4.9.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.