Skip to content

Instantly share code, notes, and snippets.

@JarrydLong
Last active October 22, 2025 06:09
Show Gist options
  • Select an option

  • Save JarrydLong/c33e312c8504532a39c2fd4d58877da8 to your computer and use it in GitHub Desktop.

Select an option

Save JarrydLong/c33e312c8504532a39c2fd4d58877da8 to your computer and use it in GitHub Desktop.
<?php
// Make all fields editable on the orders page in the PMPro dashboard
add_filter( 'pmpro_orders_read_only_fields', function( $fields ) {
return array();
} );
/**
* Register the Stripe Customer ID field for admin profiles
*/
function my_pmpro_add_stripe_customerid_field() {
// Ensure PMPro_Field class exists (PMPro 2.11+)
if ( ! class_exists( 'PMPro_Field' ) ) {
return;
}
// Don't load at checkout
if ( ! empty( $_REQUEST['pmpro_level'] ) ) {
return;
}
$fields = array();
// Define the field
$fields[] = new PMPro_Field(
'pmpro_stripe_customerid', // meta key
'text', // field type
array(
'label' => 'Stripe Customer ID',
'size' => 40,
'profile' => 'admins', // visible to admins only
'memberslistcsv' => false, // exclude from CSV exports
'required' => false,
'profile' => 'only_admin',
)
);
// Add field to the profile section (admin side)
// Add all of our fields into that group.
foreach ( $fields as $field ) {
pmpro_add_user_field(
'More Information', // Which group to add to.
$field // PMPro_Field object
);
}
}
add_action( 'init', 'my_pmpro_add_stripe_customerid_field' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment