Archived topic
WP set for anonymous comments, but the mandatory asterisks are displayed
14 replies · Started by DWCore on July 17, 2018
Hello
Unfortunately, my English is only rudimentary, so I had to use the Google translator, but I hope that my problem will be understood anyway.
I have under Settings -> discussion at the item "More comment settings" the check mark removed at "users must comment to name and e-mail address specify", so that visitors can comment anonymously.
Unfortunately, despite this setting, the fields Name and Email are still the mandatory asterisks.
What am I doing wrong or how can I solve it?
My website is not yet officially online and password protected, but you can log in as follows:
Username: Monika_Peichl
Password: EfCoFJw:6jdC
It would be great if someone could help me quickly.
Thank you very much.
best regards
Werner
Hi there,
Does this happen to new posts you created after the setting has been changed?
Hello
Since I had the setting already during the installation, this occurs with all posts. Where could the problem be?
Hey I was able to duplicate this on my end as well.
However it's the same when I try it with a default WordPress Twenty Seventeen theme.
Can you give that a test as well?
If that's the case then you might need to bring it up to WordPress support:
https://wordpress.org/support/
Let me know if this helps.
Hello and thank you for your quick reply.
When I activate the Twenty Seventeen theme it works (no stars to see). As soon as I switch back to GP, the asterisks are back.
Although I can comment anonymously, but the visitor does not know, because he sees the asterisks.
Ahh sorry I misunderstood you before.
I believe that is a bug on our end indeed.
I'll confirm with Tom :)
Thanks!
No problem :-). Please let me know if you have a solution.
See you later and thanks for the help.
That is indeed a bug.
For now, you can do this:
add_filter( 'comment_form_default_fields', function( $fields ) {
$commenter = wp_get_current_commenter();
$fields['author'] = '<label for="author" class="screen-reader-text">' . esc_html__( 'Name', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Name', 'generatepress' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />';
$fields['email'] = '<label for="email" class="screen-reader-text">' . esc_html__( 'Email', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Email', 'generatepress' ) . '" id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />';
return $fields;
}, 20 );
Let me know :)
Thank you for your proposal for a temporary solution
Unfortunately, it does something I do not want.
See for yourself:
Previous situation:
See screenshot here
Your solution suggestion: (Removes everything)
See screenshot here
Desired solution: Simply without the stars behind it :-)
See screenshot here
Can you please help me to remove only the three fields Name, Email and URL. Many Thanks
My mistake! Can you try the updated code?: https://generatepress.com/forums/topic/wp-set-for-anonymous-comments-but-the-mandatory-asterisks-are-displayed/#post-627113
Many Thanks. Works great.
So it just has "return $fields;" Missed :-)
I guess that this will generally be fixed at the next update.
Thanks again for your support.
Lovely wishes
Werner
One more question.
I wanted to remove the URL field with the following code in the function.php. But what it does is that it removes it below the email field, just to put it back in front of the send button.
// URL-Feld entfernen
/*--------------------------------------------------------*/
function remove_url_field($fields) {
if (isset( $fields['url'])) {
unset($fields['url']);
}
return $fields;
}
add_filter('comment_form_default_fields', 'remove_url_field');
Can you tell me if this is the case with you or if it is not ok with the code?
Many Thanks.
In that case, this should be your full code:
add_filter( 'comment_form_default_fields', function( $fields ) {
$commenter = wp_get_current_commenter();
$fields['author'] = '<label for="author" class="screen-reader-text">' . esc_html__( 'Name', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Name', 'generatepress' ) . '" id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30" />';
$fields['email'] = '<label for="email" class="screen-reader-text">' . esc_html__( 'Email', 'generatepress' ) . '</label><input placeholder="' . esc_attr__( 'Email', 'generatepress' ) . '" id="email" name="email" type="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30" />';
unset( $fields['url'] );
return $fields;
}, 20 );
Hello Tom,
oh dear, sometimes it can be so easy. One simple line more :-)
I could have come up with that myself.
It works great.
Thank you very much.
Werner
You're welcome! :)