• Resolved solace10

    (@solace10)


    Hey everyone

    I would like to add a custom field to the comments section on my blog posts.

    I want to capture people’s phone number but not publish it – exactly the same as with the email field.

    I’ve looked everywhere for a plugin or some code help – but I think I’ve discovered a feature that’s not been added before! In other words, there’s nothing to be found on this subject!

    I’m happy to code the comments.php file – but what I am missing is what to add to the functions.php file in order to communicate with the DB ?

    function my_fields($fields) {
    $fields['new'] = '<p>Phone Number (Optional. Will not be published)</p>';
    return $fields;
    }
    add_filter('comment_form_default_fields','my_fields');

    I would really appreciate any tips!
    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘add a "will not be published" field on comment form’ is closed to new replies.