The filter cac/editable/column_save allow you to store the editable column value to the database.

Usage

There are 2 ways to hook into cac/editable/column_save.

  • cac/editable/column_save – filter for every column
  • cac/editable/column_save/column=[column name] – filter for a specific column
/**
 * Filtering: called when a column is saved, but the saving is not handled by Admin Columns core
 * This should be used for saving columns that are editable but do not have their own CPAC_Column class
 * The first parameter, $result, should only be used if an error occurs
 *
 * Filter cac/editable/column_save
 * Filter cac/editable/column_save/column=[column name]
 *
 * @param WP_Error $result Result of saving
 * @param CPAC_Column $column Column object
 * @param int $id ID of item to be saved
 * @param mixed $value Value to be saved
 * @param CACIE_Editable_Model $editable_model Editability storage model
 */
function my_cac_save_column_value( $result, $column, $id, $value, $editable_model ) {
	// Save the value and pass the $result
	return $result;
}
add_filter( 'cac/editable/column_save', 'my_cac_save_column_value', 10, 5 );
add_filter( 'cac/editable/column_save/column=[column name]', 'my_cac_save_column_value', 10, 5 );

Example

In this example we save the value for the Title SEO column ( WordPress SEO by Yoast )

// Save the value for Title SEO column ( WordPress SEO by Yoast )

function my_cac_save_column_value_seo_title( $result, $column, $id, $value, $model ) {
	update_post_meta( $id, '_yoast_wpseo_title', $value );
}
add_filter( 'cac/editable/column_save/column=wpseo-title', 'my_cac_save_column_value_seo_title', 10, 5 );

Tutorial

You can make your own created column editable in just minutes with our tutorial on how to make a column editable.