WP_Customize_Manager::handle_override_changeset_lock_request() WordPress Method
The WP_Customize_Manager::handle_override_changeset_lock_request() method is used to override a changeset lock request. This can be useful if you want to take over a changeset that is locked by another user, or if you want to lock a changeset yourself to prevent other users from modifying it.
WP_Customize_Manager::handle_override_changeset_lock_request() #
Removes changeset lock when take over request is sent via Ajax.
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' ); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.9.0 | Introduced. |