Make mobile and name compulsory on the profile page after registration

How do I make Name and Mobile number mandatory on the Profile Page that user fills after registration


Please use this PHP snippet Make first and last name fields required for users #hivepress #users ยท GitHub
We recommend selecting Make this field required in the attribute settings for the phone number attribute.

@andrii this has to be in

wp-content/themes/experthive/functions.php file ?

// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;

// Include the theme framework.
require_once __DIR__ . '/vendor/hivepress/hivetheme/hivetheme.php';

        function( $form ) {
                $form['fields']['first_name']['required'] = true;
                $form['fields']['last_name']['required'] = true;

                return $form;

Is this fine ?


Please use this doc to add a PHP snippet How to add custom code snippets - HivePress Help Center

@andrii I already added the code you shared in the functions.php

was just asking if the file and the path is correct ?

I can log via ssh and using vim


If you add this code to the function.php of the parent theme, the changes will be restored after the update on our part.
We recommend using the Code Snippet plugin or creating a child theme and making changes there.

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