Skip to content
Docs
Get RestroPress

Filter

rpress_customers_column_{$column_name}

Updated
On this page

Filters the output of a column in the admin Customers list table.

Applied in column_default() of the customers list table for any column without a dedicated column_ method, such as email, num_purchases, amount_spent and date_created, and for columns added with rpress_report_customer_columns. The default value is the item's value for that column, or null if the item has no such key. Hook the dynamic name matching your new column slug to supply its output.

Parameters#

ParameterTypeDescription
$valuemixedThe column value that will be printed.
$customer_idintThe customer ID.

Return value#

mixed. The value or HTML to print in the column cell.

Example#

function my_customers_column_loyalty( $value, $customer_id ) {
	$points = (int) get_option( 'my_loyalty_' . $customer_id, 0 );
	return esc_html( number_format_i18n( $points ) );
}
add_filter( 'rpress_customers_column_loyalty', 'my_customers_column_loyalty', 10, 2 );

Notes#

Only reached for columns handled by the default branch. Columns the table renders with their own method (such as the name column) do not pass through this filter.

Source#

Applied in:

  • includes/admin/customers/class-customer-table.php (line 168), in RPRESS_Customer_Reports_Table::column_default()

See also#

Was this page helpful?