Last active
August 11, 2020 15:25
-
-
Save mikeyhoward1977/87f3164373c2a0c81b4ea4884e403e2e to your computer and use it in GitHub Desktop.
This code snippet enables the hiding of input fields on the Easy Plugin Demo registration form
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 | |
/** | |
* Remove registration fields from required fields list. | |
* | |
* @param array $fields Array of required field names | |
* @return array Array of required field names | |
*/ | |
function custom_epd_remove_required_fields( $fields ) { | |
// Uncomment the array values you want to remove from the required fields list | |
$remove_fields = array( | |
//'epd_first_name', | |
//'epd_last_name' | |
); | |
foreach( $remove_fields as $field ) { | |
if ( isset( $fields[ $field ] ) ) { | |
unset( $fields[ $field ] ); | |
} | |
} | |
return $fields; | |
} | |
/** | |
* Hide fields on the registration form. | |
* | |
* Make sure to mark any hidden fields as not required fields. | |
* Otherwise submitting the form will fail. | |
* | |
* Uncomment the filter for the field(s) you wish to hide. | |
* Note: These filters are only available from Easy Plugin Demo version 1.3.1 onwards | |
*/ | |
//add_filter( 'epd_register_display_firstname', '__return_false' ); // First name field | |
//add_filter( 'epd_register_display_lastname', '__return_false' ); // Last name field |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment