WordPress.org

Ready to get started?Download WordPress

Forums

custom comment_form fields not displaying (1 post)

  1. alexisfrsh
    Member
    Posted 1 year ago #

    My ideal comment form will have 3 fields- Name, Location, Comment.
    I'm using the following bits of code-

    comments.php

    <?php comment_form(
    array(
    'fields' => apply_filters( 'comment_form_default_fields', $fields ),
    'comment_notes_after' => ' ',
    'title_reply' => 'Please feel free to share your home owning hopes, dreams, or concerns?',
    'logged_in_as' => '',
    )
    ); ?>

    functions.php

    <?php
    function my_fields($fields) {
    $fields['Name'] = '<p>Name</p>';
    $fields['Location'] = '<p>Location</p>';
    return $fields;
    }
    add_filter('comment_form_default_fields','my_fields');
    ?>

    As you can see on the live site, that's not working. Any ideas why/how to remedy?

Topic Closed

This topic has been closed to new replies.

About this Topic