Title: Adjust Campaign Export Fields
Last modified: September 23, 2020

---

# Adjust Campaign Export Fields

 *  Resolved [fceadmin](https://wordpress.org/support/users/fceadmin/)
 * (@fceadmin)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/adjust-campaign-export-fields/)
 * Hello,
 * I’m looking for a way to add fields to the export function in Charitable. I have
   a new ACF field added for the campaign post type (for now just ‘type’ as an example).
   Is there any way to add this post_meta field to the export?

Viewing 1 replies (of 1 total)

 *  [Eric Daams](https://wordpress.org/support/users/ericdaams/)
 * (@ericdaams)
 * [5 years, 7 months ago](https://wordpress.org/support/topic/adjust-campaign-export-fields/#post-13473966)
 * Hi [@fceadmin](https://wordpress.org/support/users/fceadmin/),
 * The best way to add a field to the Campaigns export is with the Campaign Fields
   API. Here’s some sample code showing how to do that:
 *     ```
       add_action( 'init', function() {
           $field = new Charitable_Campaign_Field( 'my_meta_field', array(
               'label'          => 'My Meta Field',
               'admin_form'     => false,
               'show_in_export' => true,
               'email_tag'      => false,
               'value_callback' => function( Charitable_Campaign $campaign ) {
                   return get_post_meta( $campaign->ID, 'my_meta_field', true );
               },
           ) );
   
           charitable()->campaign_fields()->register_field( $field );
       } );
       ```
   
 * The ‘label’ will be used as the export column header. ‘show_in_export’ needs 
   to be true to have it added to the Campaign export. Finally, ‘value_callback’
   should be a function that returns the value of the post meta field. This function
   will receive a Charitable_Campaign object as the first parameter. The example
   above gets the value of a post meta field with a key of ‘my_meta_field’.
 * Hope that helps! If you’re not sure how to add code like this to your site, check
   out our guide here:
 * [https://www.wpcharitable.com/documentation/3-ways-to-add-code-customizations-to-your-site/](https://www.wpcharitable.com/documentation/3-ways-to-add-code-customizations-to-your-site/)
 * Cheers,
    Eric

Viewing 1 replies (of 1 total)

The topic ‘Adjust Campaign Export Fields’ is closed to new replies.

 * ![](https://ps.w.org/charitable/assets/icon-128x128.jpg?rev=1225178)
 * [Charitable - Donation Plugin for WordPress - Fundraising with Recurring Donations & More](https://wordpress.org/plugins/charitable/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/charitable/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/charitable/)
 * [Active Topics](https://wordpress.org/support/plugin/charitable/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/charitable/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/charitable/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Eric Daams](https://wordpress.org/support/users/ericdaams/)
 * Last activity: [5 years, 7 months ago](https://wordpress.org/support/topic/adjust-campaign-export-fields/#post-13473966)
 * Status: resolved