Embed Snippet on Your Site
MemberPress: Exclude Specific Custom Fields from MemberPress Registration Forms
This code snippet allows you to hide specific custom fields on MemberPress registration forms when a particular URL parameter is present. This approach is particularly useful for corporate accounts or specialized registration flows where you want to customize the registration form for specific types of registrations.
This functionality is triggered only when a specific query parameter (ca in this example) is present in the URL.
To exclude different custom fields, modify the $excluded_fields array on lines 9 and 28 with your custom field keys:
$excluded_fields = array( 'your_custom_field_key1', 'your_custom_field_key2' );
Replace your_custom_field_key1 and your_custom_field_key2 with the actual field keys of the custom fields you want to exclude. The field keys can be found in the MemberPress settings (Dashboard > MemberPress > Settings) under the Fields tab.
If you want to use a different URL parameter, replace ca with your desired parameter name, on lines 12 and 24:
if ( $post->ID > 0 && MeprProduct::is_product_page( $post ) && isset( $_GET['ca'] ) ) {
// Your code here
}
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
Comments