Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,
    You can’t do that with our current settings.
    But you can do it by custom js and php codes.

    Here is the example,

    add_action('wp_footer', 'footer_script');
    function footer_script() {
        global $current_user;
        wp_get_current_user() ;
        $user_name = $current_user->display_name 
                        ? $current_user->display_name 
                        : $current_user->user_login;
        ?>
        <script>
            jQuery(document).ready(function () {
                // Replace #some_element_id with your field element id
                jQuery('#some_element_id').val('<?php echo $user_name; ?>');
            });
        </script>
        <?php
    }

    Add this code to your functions.php file in the theme root folder. Replace the #some_element_id with your element id.

    Thank You!

    Thread Starter mebs77

    (@mebs77)

    Im getting an error on line 3, any ideas?

    Can you please share the error log
    Or error that is displayed.

    Hi,
    It’s been a week we didn’t got any reply from your side.
    We hope the issue is resolved.
    Please feel free to contact us if you have further queries.

    Thank You!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Prepopulate Field’ is closed to new replies.