A Cozmoslabs Product
Documentation / Developer Knowledge Base / Add custom column to the Members List table

Add custom column to the Members List table

Using custom code, the Members List table from Paid Member Subscriptions can be extended to show extra columns with arbitrary data.

This can be achieved using some custom code:

add_filter( 'pms_members_list_table_columns', 'pmsc_modify_members_list_columns' );
function pmsc_modify_members_list_columns( $columns ){
    $columns['custom-column'] = 'Custom Column';

    return $columns;
}

add_filter( 'pms_members_list_table_entry_data', 'pmsc_modify_members_list_data', 20, 2 );
function pmsc_modify_members_list_data( $data, $member ) {

    $data['custom-column'] = get_user_meta( $member->user_id, 'your_custom_field', true );

    return $data;

}

The first function adds the column while the second one adds the data that will be displayed in it. This is just an example, so make sure you change the column and usermeta field slug.

In the first function, if you re-arrange the items from the $columns array, you can control in which order the columns are displayed.

Paid Member Subscriptions Pro

Accept (recurring) payments, create subscription plans and restrict content on your website. Easily setup a WordPress membership site using Paid Member Subscriptions.

Get Paid Member Subscriptions

The Ultimate Membership Bundle

Combine the power of Profile Builder with Paid Member Subscriptions to set up user registration, memberships, and recurring revenue.

Get 25% off with the bundle

Help & Support

We’re here to help you every step of the way.

Open a Support Ticket