This documentation is deprecated since Admin Columns version 4.
Please view the updated version of this documentation here.

The filter cac/column/meta/value allows you to change what’s displayed in a custom field column. It behaves very similarly to cac/column/value. The main difference is that cac/column/meta/value is applied to the “inner” column value, i.e. the column value without the before and after strings, whereas cac/column/value is applied after all other formatting is done.

Usage

/**
 * Filter the display value for Custom Field columns
 *
 * @param mixed $value Custom field value
 * @param int $id Object ID
 * @param object $this Column instance
 */
function my_cac_filter_column_meta_value( $value, $id, $column ) {

    // Possibly modify $value

    return $value;
}
add_filter( 'cac/column/meta/value', 'my_cac_filter_column_meta_value', 10, 3 );

Example

Mask column output

In the example below, we mask the custom field output. The result will look like ‘******7163’, instead of the full number.

/**
 * Mask the custom field output. The result will look like '******7163', instead of the full number.
 *
 */
function my_column_meta_value_mask_key( $value, $object_id, $column ) {
	$custom_field_key = 'custom_field_key';

	if ( 'column-meta' == $column->get_type() && $custom_field_key == $column->get_field() ) {
		$value = str_repeat ( '*', 6 ) . substr( $value, -4 );
	}

	return $value;
}
add_filter( 'cac/column/meta/value', 'my_column_meta_value_mask_key', 10, 3 );