acp/editing/saved

The acp/editing/saved action fires after the value of a column is stored when using Inline Edit.

Usage

/**
 * Fires after a inline-edit saved a value
 *
 * @param AC_Column $column Column instance
 * @param int $id Item ID
 * @param string $value User submitted input
 */
function my_acp_after_ajax_column_save( $column, $id, $value ) {
	// Place your code here
}
add_action( 'acp/editing/saved', 'my_acp_after_ajax_column_save', 10, 3 );

Examples

Update post modified date after saving

By default, the post modified date is not updated when using inline edit with Admin Column Pro. This example shows how you can change the modified date of a post when using inline edit.

/**
 * Updates the post modified data after inline edit 
 *
 * @param AC_Column $column Column instance
 * @param int $id Item ID
 * @param string $value User submitted input
 */
function my_acp_after_ajax_column_save_update_post_date( $column, $id ) {
	if( 'post' === $column->get_list_screen()->get_meta_type() ){
		wp_update_post( array( 'ID' => $id ) );
	}
}
add_action( 'acp/editing/saved', 'my_acp_after_ajax_column_save_update_post_date', 10, 2 );

Trigger a custom method after updating a custom field value

First, we check for AC_Column_Meta because this column has a get_meta_key() method. Secondly, we check for the right post type and then for a specific custom field key.

/**
 * Trigger a custom method after editing a custom field value (on a page)
 *
 * @param AC_Column $column Column instance
 * @param int       $id     Item ID
 * @param string    $value  User submitted input
 */
function my_acp_after_ajax_column_save_update_custom_field_value( $column, $id, $value ) {

	// Check for a custom field column
	if ( ! $column instanceof AC_Column_Meta ) {
		return;
	}

	$custom_field = 'my_custom_field';
	$post_type = 'page';

	if ( $post_type === $column->get_post_type() && $custom_field === $column->get_meta_key() ) {

		// Trigger a custom method.
		// In this case we update the modified date of the post.
		wp_update_post( array( 'ID' => $id ) );
	}
}

add_action( 'acp/editing/saved', 'my_acp_after_ajax_column_save_update_custom_field_value', 10, 2 );