---
title: "Adding Custom Columns To CSV Export"
source: "https://docs.nexcess.com/software/kadence/restrict-content-pro/adding-custom-columns-to-csv-export/"
description: "Coming soon: Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experien…"
vertical: "Software"
area: "Restrict Content Pro"
date: "2023-04-20"
last_modified: "2026-08-12"
---

# Adding Custom Columns To CSV Export

**Coming soon:** Restrict Content Pro is becoming Kadence Memberships. You may see both names used while we update the product, documentation, and customer experience.

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/ There are two steps to adding custom columns to a members or payments export: Add your column header Add the column data for each member or payment Adding Your Column Header A custom column is added with the following filter: rcp\_export\_csv\_cols\_{$export\_type}, where $export\_type is either “members” (for a memberships export) or “payments” (for a payment export). Here’s an example for adding a new “Referrer” column to the memberships export: /\*\* \* Add new export column for “Referrer”. \* \* @param array $columns Default column headers. \* \* @return array \*/ function ag\_rcp\_members\_export\_referrer\_header( $columns ) { $columns\[‘referrer’\] = \_\_( ‘Referrer’ ); return $columns; } add\_filter( ‘rcp\_export\_csv\_cols\_members’, ‘ag\_rcp\_members\_export\_referrer\_header’ ); Adding The Column Value For Each Row The next step is to add the corresponding value for each member or payment. Memberships For memberships, this is done with the rcp\_export\_memberships\_get\_data\_row filter. Two parameters are passed in: $row (array) – An array of key/value pairs for the current membership. $membership (RCP\_Membership) – RCP\_Membership object for the current membership being exported. Here’s an example for adding the referrer metadata for each membership: /\*\* \* Add the referrer meta value for each membership. \* \* @param array $row Array of data to be exported for the current membership. \* @param RCP\_Membership $membership Membership object. \* \* @return array \*/ function ag\_rcp\_memberships\_export\_referrer( $row, $membership ) { $row\[‘referrer’\] = rcp\_get\_membership\_meta( $membership->get\_id(), ‘referrer’, true ); // Or you can add a piece of user meta like this: // $row\[‘my\_field’\] = get\_user\_meta( $membership->get\_customer()->get\_user\_id(), ‘my\_custom\_field’, true ); return $row; } add\_filter( ‘rcp\_export\_memberships\_get\_data\_row’, ‘ag\_rcp\_memberships\_export\_referrer’, 10, 2 ); Payments For payments, this is done with the rcp\_export\_payments\_get\_data\_row filter. Two parameters are passed in: $row (array) – An array of key/value pairs for the current payment. $payment (object) – Payment object from the database. The payment ID can be retrieved with: $payment->id Here’s an example for adding the transaction ID for each payment (note: you also need to add the column header, as explained previously): /\*\* \* Add the transaction ID value for each payment. \* \* @param array $row Array of data to be exported for the current payment. \* @param object $payment Payment object from the database. \* \* @return array \*/ function ag\_rcp\_payments\_export\_transaction\_id( $row, $payment ) { $row\[‘transaction\_id’\] = $payment->transaction\_id; return $row; } add\_filter( ‘rcp\_export\_payments\_get\_data\_row’, ‘ag\_rcp\_payments\_export\_transaction\_id’, 10, 2 );
