WP_Customize_Manager::handle_override_changeset_lock_request()
- Since
- 4.9.0
- Source
wp-includes/class-wp-customize-manager.php:3391
Removes changeset lock when take over request is sent via Ajax.
Uses · 9
- wp_send_json_error()Sends a JSON response back to an Ajax request, indicating failure.
- check_ajax_referer()Verifies the Ajax request to prevent processing requests external of the blog.
- __()Retrieves the translation of $text.
- current_user_can()Returns whether the current user has the specified capability.
- get_post_type_object()Retrieves a post type object by name.
- wp_send_json_success()Sends a JSON response back to an Ajax request, indicating success.
- WP_Customize_Manager::is_preview()Determines whether it is a theme preview or not.
- WP_Customize_Manager::changeset_post_id()Gets the changeset post ID for the loaded changeset.
- WP_Customize_Manager::set_changeset_lock()Marks the changeset post as being currently edited by the current user.
Source
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' ); }History
Introduced in 4.9.0. One change between 6.7.7 and 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
7.1.0
Return type changed from
none to never.verified against source4.9.0
Introduced.from the docblock
About this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-includes/class-wp-customize-manager.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.