How to Add Extra Field WordPress Registration Form

Add Tool

Add Extra Field WordPress Registration Form

Now a day WordPress is a popular blogging platform and the popularity of WordPress is increasing day by day. Someone want to create multiply author blog site. So to create multi author blog site or professional web site need to create a powerful registration form. If you look at the WordPress default registration form you will see like the below image.

 Add Extra Field WordPress Registration Form

We can customize WordPress registration form for our blog site and our client’s web site. When you create your client website as a freelancer you will face many problem. Suppose your client want to add some another field like Phone, Name with their WordPress registration form. What will you do? Don’t worry we can customize our WordPress registration form and add some new field such as Password, Country, Fax No, Address, zip code etc. extra fields by editing our functions.php file. It’s very simple. Simply add the below PHP codes snippets in your functions.php file. It will add Name and Phone text field with your default wordpress registration form.

// This function add form field on registration page

// This function add validation

// This function calls insert entry
add_action('user_register', 'register_extra_fields');

// declare the function
function show_custom_field() {?>

  <label>Name *
    <input id="custom_user_name" type="text" size="25" value="<?php echo $_POST['custom_user_name']; ?>" name="custom_user_name"/>
    <input id="custom_user_phone" type="text" size="25" value="<?php echo $_POST['custom_user_phone']; ?>" name="custom_user_phone"/>
<?php }

// validation function
function check_fields($login, $email, $errors) {
global $custom_user_name, $custom_phone;
if ($_POST['custom_user_name'] == '') {
$errors->add('empty_realname', "<strong>Error:</strong> Please enter Name.");
else {
$custom_user_name = $_POST['custom_user_name'];
$custom_user_phone = $_POST['custom_user_phone'];
// This makes an entry into database amazing...

function register_extra_fields($user_id, $password="", $meta=array())  {
// Gotta put all the info into an array
$userdata = array();
$userdata['ID'] = $user_id;

// Name
$userdata['custom_user_name'] = $_POST['custom_user_name'];

// Phone
$userdata['custom_user_phone'] = $_POST['custom_user_phone'];

// Enters into DB
} ?>

After adding the following code in your functions.php file, it will automatically add new fields “Name” and “Phone” below username and email fields in “WordPress registration form”. Than your registration form will look like the below image.

Add Extra Field WordPress Registration Form

Want to add more fields simply copy a field and make some change. If you notice carefully, you will success to create new and new extra fields with your WordPress registration form.

I hope you have add extra

field WordPress registration form following this WordPress snippets.

If this trick is helpful to add fields to wordpress registration form please share it with your friends. You share may be helpful for this website and your friends who need to add custom fields in wordpress registration form.

Tags: wordpress registration form, wordpress user registration form plugin, user registration form wordpress plugin, login and registration form plugin for wordpress, wordpress popup registration form plugin, registration form wordpress

About Masum Billah

Add Extra Field WordPress Registration Form 1stWebSuite website seo tool is a free website ranking tool site provides a lot of on page and off page seo useful tools for you. On this site, we have a large number of website ranking tools


Discuss about: How to Add Extra Field WordPress Registration Form