Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#21877 closed defect (bug) (invalid)

Disabling author field in comments makes "awaiting moderation" go away

Reported by: hakankpunkt Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.4.1
Component: Comments Keywords: close
Focuses: Cc:


If one disables the author field via


then writes a comment, the comment does not show up as "awaiting moderation" on the comment overview page.

Disabling the email and/or url field does not effect the "awaiting moderation" status.

Change History (9)

#1 @hakankpunkt
3 years ago

I missed the closing brace:


#2 @scribu
3 years ago

  • Keywords reporter-feedback added

I don't understand where the unset() line goes. Did you modify a core WP file?

#3 @hakankpunkt
3 years ago

I added this filter in the themes functions.php to disable some
fields including the author field. Please note, that only disabling
the author field is causing the bug.

 * Disable comment fields
 * @param array The fields array
 * @return array The fields array with the disabled comment fields
function disable_comment_fields($fields)

	return $fields;

add_filter('comment_form_default_fields', 'disable_comment_fields', 10030);

As a workaround I used following filter in the themes function.php

 * Set a default author name for comments
 * This is a workaround for this bug http://core.trac.wordpress.org/ticket/21877
function set_default_author_name($data)
    return 'John Doe Default';

add_filter('pre_comment_author_name', 'set_default_author_name', 10050);

#4 @scribu
3 years ago

Much better; thanks.

Does this happen with the twentyeleven theme or just with your theme?

#5 @hakankpunkt
3 years ago

It happens with our theme and the Twenty Eleven theme. I just tested the Twenty Ten theme and it happens with it as well.

#6 @hakankpunkt
3 years ago

Just tested it with WordPress version 3.4.2 and the Twenty Ten theme and it happens with it as well.

#7 @SergeyBiryukov
3 years ago

  • Keywords close added; reporter-feedback removed

Comments awaiting moderation are only displayed to their authors:

If comment author is logged in, then $user_ID is passed, and comments from moderation queue are still displayed (since [5238]), regardless of whether 'author' field is disabled or not.

If comment author is not logged in and 'author' field is disabled, then $comment_author is empty, and comments from moderation queue are not retrieved.

This sounds like expected behaviour, I don't see a bug here.

#8 @nacin
3 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

Nice investigation. I agree.

#9 @hakankpunkt
3 years ago

Sergey, thanks for the details. Now the behavior makes sense.

Note: See TracTickets for help on using tickets.