This action cac/inline-edit/after_ajax_column_save is triggered after a column value has been updated when using Inline Edit.

Usage

/**
 * Fires after a inline-edit saved a value
 *
 * @param CPAC_Column $column Column instance
 * @param int $id Item ID
 * @param string $value User submitted input
 * @param object $editable_model_object CACIE_Editable_Model $editable_model_instance Editability model instance
 */
function my_cac_after_editable_column_save( $column, $id, $value, $editable_model_object ) {
    // Place your code here
}
add_action( 'cac/inline-edit/after_ajax_column_save', 'my_cac_after_editable_column_save', 10, 4 );

Example

These are working examples. Just place the code in your theme’s functions.php if you like to use them.

Last modified date

In this example we will update the post’s last modified date after using inline-editing.

/**
 * Example: Update last post modified date when using inline-edit
 *
 */
function my_cac_update_last_modifed_date_on_save( $column, $id, $value, $editable_model_object ) {

	// only apply to post object
	if ( 'post' == $column->storage_model->meta_type ) {

		// updating post with no vars to set modified date
		wp_update_post( array( 'ID' => $id ) );
	}
}
add_action( 'cac/inline-edit/after_ajax_column_save', 'my_cac_update_last_modifed_date_on_save', 10, 4 );

Update another field

In this example we will update another custom field when we change a title with inline-edit.

/**
 * Example: Updates another field after Inline edit has been used
 *
 * In this example we update another custom field called 'my_custom_field' after inline edit
 * has been used on the title column of a page.
 *
 */
function my_cac_after_title_save_update_custom_field( $column, $id, $value, $editable_model_object ) {

    // only applies when the column type is a 'title' and is from the post type 'page'
    if ( 'title' === $column->get_type() && 'page' == $column->get_post_type() ) {

        // update another custom field
        update_post_meta( $id, 'my_custom_field', $value );
    }
}
add_action( 'cac/inline-edit/after_ajax_column_save', 'my_cac_after_title_save_update_custom_field', 10, 4 );