Changing the Comment Fields using Filter (without success)

Question

Am I doing this all wrong or should this be working? No matter what post I visit, it’s thrown into an endless loop..

This is the code:

add_filter('comment_form_fields', 'comment_form_args');
function comment_form_args( $fields ) {

  if ( ! is_user_logged_in() ) {
    comment_form(array(
    'label_submit' => __('Submit for Approval'),
    'comment_notes_before' => '',
    'title_reply' => 'Need to ask something? Go ahead.',
    'title_reply_to' => 'Your reply to %s',
    'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( '', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
    'comment_notes_after' => '<p>Be polite and specific. Spam will be deleted.</p>'
    )
  );
  } else {

    comment_form(array(
    'label_submit' => __('Submit'),
    'comment_notes_before' => '',
    'title_reply' => '',
    'title_reply_to' => 'Answer %s',
    'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( '', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
    'comment_notes_after' => ''
    )
  );

  }
}

0
Marcus Wood 7 months 2022-01-13T15:40:13-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse