---
title: "Add A New Column To The Admin Memberships Table"
source: "https://docs.nexcess.com/software/kadence/restrict-content-pro/add-a-new-column-to-the-admin-memberships-table/"
description: "Note: This is part of the developer docs and is considered custom code. Unfortunately, we cannot provide support for custom code at this time as we do not have…"
vertical: "Software"
area: "Restrict Content Pro"
date: "2023-04-20"
last_modified: "2023-04-20"
---

# Add A New Column To The Admin Memberships Table

Note: This is part of the developer docs and is considered custom code. Unfortunately, we cannot provide support for custom code at this time as we do not have the additional resources that would be necessary to provide support for custom code. If you need assistance with this, please reach out to our list of consultants for further assistance: https://codeable.io/developers/restrict-content-pro/ If you’ve added some custom membership meta you may want to add a new column to the admin Memberships table to display that value. This can be done in two steps: Register your new column name. Display the column value for each membership. This tutorial will walk you through these two steps using some custom membership meta for “Company”. 1. Register The Column Name This adds the column to the table, just without any values. For this we use the rcp\_memberships\_list\_table\_columns filter. function ag\_rcp\_memberships\_list\_table\_columns( $columns ) { $key = ‘company’; // All lowercase, no spaces. Your unique ID for your column. $name = \_\_( ‘Company’, ‘rcp’ ); // Label to be displayed on the column header. Spaces are okay. $columns\[ $key \] = $name; return $columns; } add\_filter( ‘rcp\_memberships\_list\_table\_columns’, ‘ag\_rcp\_memberships\_list\_table\_columns’ ); The $key value needs to be changed. This should be all lowercase and use underscores instead of spaces (or no spaces). The $name value needs to be changed. This is the label that is displayed in the column header. Spaces are okay here. Once configured, the column will appear on the table, like so: 2. Display The Column Value The next step is to populate the column value for each membership record. For this we use the rcp\_memberships\_list\_table\_column\_{column} filter. function ag\_rcp\_memberships\_list\_table\_column\_company( $value, $membership ) { $company = rcp\_get\_membership\_meta( $membership->get\_id(), ‘company’, true ); return $company; } add\_filter( ‘rcp\_memberships\_list\_table\_column\_company’, ‘ag\_rcp\_memberships\_list\_table\_column\_company’, 10, 2 ); Make sure you edit the rcp\_memberships\_list\_table\_column\_company filter to match your column key that you set in step 1. The correct filter to use is rcp\_memberships\_list\_table\_column\_{column\_key} where {column\_key} is the key you chose. In my case that’s company, which is why my filter name is rcp\_memberships\_list\_table\_column\_company. Inside the function, we use the membership meta API to retrieve our desired value. You will need to edit this to return your desired value. In this example, we retrieve the membership meta ‘company’. In the end, the table looks like this: 3. Remove Default Columns You can also use the rcp\_memberships\_list\_table\_columns filter to remove default columns. All you need to know is the key to the column you want to remove. The default keys are as follows: customer – Customer column object\_id – Membership level name column status – Status column auto\_renew – Recurring column created\_date – Created column expiration\_date – Expiration date column For example, this code can be used to remove the created date column: function ag\_rcp\_memberships\_list\_remove\_column( $columns ) { $key\_to\_remove = ‘created\_date’; // Change this to the key you want to remove. if ( array\_key\_exists( $key\_to\_remove, $columns ) ) { unset( $columns\[ $key\_to\_remove\] ); } return $columns; } add\_filter( ‘rcp\_memberships\_list\_table\_columns’, ‘ag\_rcp\_memberships\_list\_remove\_column’ ); Please note: All of these examples serve as a guideline and are here for your convenience. We do not provide support for troubleshooting or modifying these and we do not provide support for any custom development. If you need help with any of these examples, consider hiring a developer.
