Skip to content

Instantly share code, notes, and snippets.

@ipokkel
Created April 4, 2023 05:18
Show Gist options
  • Save ipokkel/12bfda9cebec8e4a7cf71a8ff7d18d1c to your computer and use it in GitHub Desktop.
Save ipokkel/12bfda9cebec8e4a7cf71a8ff7d18d1c to your computer and use it in GitHub Desktop.
Add PMPro User Fields as fields for Add Member from Admin.
<?php
/**
* Set addmember attribute on user fields to true.
*
* This will add the field to the Add Member from Admin page in the
* administration area.
*
* 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_pmpro_set_user_field_addmember( $field, $where ) {
$field->addmember = true;
return $field;
}
add_filter( 'pmpro_add_user_field', 'my_pmpro_set_user_field_addmember', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment