Created
February 20, 2026 11:10
-
-
Save JarrydLong/011c0ae5167a2b4780d73ab1c2e973df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php //do not copy | |
| /* This recipe send additional data to Kit to populate custom fields | |
| * | |
| * You can add this recipe to your site by creating a custom plugin | |
| * or using the Code Snippets plugin available for free in the WordPress repository. | |
| * Read this companion article for step-by-step directions on either method. | |
| * https://www.paidmembershipspro.com/create-a-plugin-for-pmpro-customizations/ | |
| */ | |
| function my_pmprokit_subscriber_data( $subscriber_data, $user ) { | |
| /** | |
| * Create a field in Kit. The label used in Kit should match the key used in the field array below. | |
| * In this example, we are using "company" as the key and label. The value is being pulled from the user meta field "company". If the user meta field is empty, we are defaulting to "NA". You can change this to whatever you want or remove it if you don't want a default value. | |
| */ | |
| $subscriber_data['fields']['Company'] = $user->company ?? 'N/A'; | |
| return $subscriber_data; | |
| } | |
| add_filter( 'pmprokit_subscriber_data', 'my_pmprokit_subscriber_data', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment