wppaste
WordPress

wp_ajax_inline_save()

Since
3.1.0
Source
wp-admin/includes/ajax-actions.php:2085
Handles Quick Edit saving a post from a list table via AJAX.

Hooks fired · 1

One hook fires while wp_ajax_inline_save() runs, in this order:

  1. apply_filters( quick_edit_show_taxonomy )filterline 2165 (+80 into the body)

    Filters whether the current taxonomy should be shown in the Quick Edit panel.

Uses · 16

Show all 16

Source

function wp_ajax_inline_save() {	global $mode; 	check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); 	if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) {		wp_die();	} 	$post_id = (int) $_POST['post_ID']; 	if ( 'page' === $_POST['post_type'] ) {		if ( ! current_user_can( 'edit_page', $post_id ) ) {			wp_die( __( 'Sorry, you are not allowed to edit this page.' ) );		}	} else {		if ( ! current_user_can( 'edit_post', $post_id ) ) {			wp_die( __( 'Sorry, you are not allowed to edit this post.' ) );		}	} 	$last = wp_check_post_lock( $post_id ); 	if ( $last ) {		$last_user      = get_userdata( $last );		$last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); 		/* translators: %s: User's display name. */		$msg_template = __( 'Saving is disabled: %s is currently editing this post.' ); 		if ( 'page' === $_POST['post_type'] ) {			/* translators: %s: User's display name. */			$msg_template = __( 'Saving is disabled: %s is currently editing this page.' );		} 		printf( $msg_template, esc_html( $last_user_name ) );		wp_die();	} 	$data = &$_POST; 	$post = get_post( $post_id, ARRAY_A );	if ( ! $post ) {		wp_die();	} 	// Since it's coming from the database.	$post = wp_slash( $post ); 	$data['content'] = $post['post_content'];	$data['excerpt'] = $post['post_excerpt']; 	// Rename.	$data['user_ID'] = get_current_user_id(); 	if ( isset( $data['post_parent'] ) ) {		$data['parent_id'] = $data['post_parent'];	} 	// Status.	if ( isset( $data['keep_private'] ) && 'private' === $data['keep_private'] ) {		$data['visibility']  = 'private';		$data['post_status'] = 'private';	} elseif ( isset( $data['_status'] ) ) {		$data['post_status'] = $data['_status'];	} 	if ( empty( $data['comment_status'] ) ) {		$data['comment_status'] = 'closed';	} 	if ( empty( $data['ping_status'] ) ) {		$data['ping_status'] = 'closed';	} 	// Exclude terms from taxonomies that are not supposed to appear in Quick Edit.	if ( ! empty( $data['tax_input'] ) ) {		foreach ( $data['tax_input'] as $taxonomy => $terms ) {			$tax_object = get_taxonomy( $taxonomy );			/** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */

History

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-admin/includes/ajax-actions.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.