Ok, so i tried this and it worked as expected, i replaced the above code (used in comment.php) with the one bellow.
To correct this issue i simply checked if the user is logged in using is_user_logged_in()
and then added the comment field to the $comments_args
.
<?php $comments_args = array(
'id_form' => 'comment-form',
'class_form' => 'comment-form',
'class_submit' => 'btn btn-default',
'title_reply' => __( 'Leave a reply', 'magneton' ),
'label_submit' => __( 'Submit Comment', 'magneton' )
); ?>
<?php if ( !is_user_logged_in() ) : ?>
<?php comment_form( $comments_args ); ?>
<?php else : ?>
<?php $comments_args[ 'comment_field' ] = '<textarea name="comment" id="comment" class="form-control comment-field" aria-required="true" rows="10"></textarea>'; ?>
<?php comment_form( $comments_args ); ?>
<?php endif ?>
Explanation
My original customization for of the comment form (as seen about in the function.php file) added a custom <textarea>
to the default $fields
array and filtered the comment_form_default_fields
hook. The result of this caused the comment field as well as the other custom fields (user/email/url) to disappear when the user is logged in. I suspect this a natural behavior in WordPress since this information is retrieved from the users profile.
Appreciate any comments in regard to the quality of this solution.