Removing email field from settings form

Steps to reproduce

I attempted to remove the email field from the settings page so I could move it to a separate security page using my own form.

add_filter( 'hivepress/v1/forms/user_update', [ $this, 'settings_form' ], 1000 );
public function settings_form( $form ) {
    unset( $form[ 'fields' ][ 'email' ] );
    return $form;
} // End settings_form()

Actual result

Every time I save the form, no matter what I update, it gives me an error saying that I need to enter my current password. If I refresh, the update was saved regardless, so it didn’t actually need my current password.

Expected result

Allow it to save without having an email field.

Temporary solution

Add to CSS:

.hp-template--user-edit-settings-page .hp-form__field:has(input[name="email"]) {
	display: none !important;


Yes, this validation is added in the code of the form action itself - hivepress/includes/controllers/class-user.php at master · hivepress/hivepress · GitHub. Unfortunately, there is no simple solution. But as a workaround, you can simply hide this field using CSS (this will not affect security if you have a separate form with the same functionality). As a more complicated option, it can be done through PHP and REST actions, but it will require detailed testing and code review.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.