Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This code snippet enables the hiding of input fields on the Easy Plugin Demo registration form
<?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