Wanting to add "Address" and "Phone" as required fields to the registration form (4 posts)

  1. fabelmik
    Posted 3 years ago #


    I´m very new at WordPress. Normally I work with Joomla, but for my current project I was "forced" to go the WordPress route :)

    Unfortunately this means that some of the more simpler tasks are really giving me headaches..

    Now, my problem is that I simply cannot figure out how to edit the standard WordPress registration form so that it also contains an "Address" and a "Phone" field. They both need to be required btw.

    Can someone help me with this?

  2. You need to learn about action hooks and filters with wordpress :)

    You will need to hook into the "register_form" action hook. This will be done as a custom function in your child themes functions.php file.

    Something like this should do the trick:

    // output the form field
    add_action('register_form', 'ad_register_fields');
    function ad_register_fields() {
            <label for="address"><?php _e('Address') ?><br />
            <input type="address" name="address" id="address" class="input" value="<?php echo esc_attr($_POST['address']); ?>" size="25" tabindex="20" />
            <label for="phone"><?php _e('Phone') ?><br />
            <input type="phone" name="phone" id="phone" class="input" value="<?php echo esc_attr($_POST['phone']); ?>" size="25" tabindex="21" />
    // save new Address
    add_filter('pre_user_address', 'ad_user_address');
    function ad_user_address($address) {
        if (isset($_POST['address'])) {
            $address = $_POST['address'];
        return $address;
    // save new Phone
    add_filter('pre_user_phone', 'ad_user_phone');
    function ad_user_phone($phone) {
        if (isset($_POST['phone'])) {
            $phone = $_POST['phone'];
        return $phone;
  3. fabelmik
    Posted 3 years ago #

    Thanks, that´s great help!

    I will try that out as soon as possible.

    I have one other small issue, also apparently because of my lack of WordPress experience.. I need to paginate the Gallery page on the site.

    I have 4 different gallery pages where I use the shortcode [gallery]
    and then for each media file I assign to one of the four pages.

    What I want is to show pagination on each of the four pages. Right now it shows all images on the pages, even though there are 100+ images and that´s not so good.

    I would think that there must be somewhere in admin where you can set the standard max number of images shown on each page so that there will automatically be a pagination, but I cannot find this option in admin..

    Please help. I´m such a wordpress nooob

  4. I would switch to using a plugin like this:

    It is already written to allow pagination. No sense in re-inventing the wheel ;)

Topic Closed

This topic has been closed to new replies.

About this Topic