acp/editing/save_value

Filter acp/editing/save_value for changing the value before storing it to the database.

Usage

/**
 * Filter for changing the value before storing it to the DB
 *
 * @param mixed $value Value send from inline edit ajax callback
 * @param object AC_Column #column
 * @param int $id ID
 */
function my_acp_editable_ajax_column_save_value( $value, $column, $id ) {

	// Possibly modify $value

	return $value;
}
add_filter( 'acp/editing/save_value', 'my_acp_editable_ajax_column_save_value', 10, 3 );

Examples

/**
 * Change the value to a timestamp for a specific custom field
 *
 * @param mixed $value
 * @param AC_Column $column
 * @param int $id
 */
function acp_editing_change_date_format_for_cf( $value, $column, $id ) {
	if( $column instanceof ACP_Column_CustomField ){

		if( 'my_cf_date_key' === $column->get_meta_key() ){
			$value = strtotime( $value );
		}
	}

	return $value;
}
add_filter( 'acp/editing/save_value', 'acp_editing_change_date_format_for_cf', 10, 3 );

Legacy

The old filter cac/inline-edit/ajax-column-save/value is replaced by acp/editing/save_value since Admin Columns Pro 4.0.