• Hello, I have been trying to customize the comment form on blog posts in order to send a custom field with the comment. I added the field successfully but after sending the comment the field doesn’t get sent. It’s urgent that I get it working, I need it to be included in the e-mail sent when a post is submitted.

    Here’s the code I used to remove the url and include a nationality field:

    function mytheme_remove_url($arg) {
        $arg['url'] = '';
        return $arg;
    }
    add_filter('comment_form_default_fields', 'mytheme_remove_url');
    
    function my_fields($fields) {
        $fields['new'] = '<p><label for="nationality">Nationality</label>
        <input type="text" name="nationality" id="nationality" /></p>';
        return $fields;
    }
    add_filter('comment_form_default_fields','my_fields');

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)

The topic ‘Send custom data through comment form’ is closed to new replies.