For a custom role, I've to remove/hide the email and URL fields in the author box inside the Edit Comment area in WP admin. Only the name field should be visible there.

edit comments page in wp-admin

I've to keep the URL and email field enabled for comments in the discussion settings, and can't hide the fields only on the frontend using CSS. They should be removed entirely from the source code of the page, so backend code which removes the fields would be the most likely approach.

Example URL of an edit comment page in WP admin: wp-admin/comment.php?action=editcomment&c=544499.

The form comes from wp-admin/edit-form-comment.php, which is called from wp-admin/comment.php. Can anyone suggest a way to remove the 2 fields from showing up in the form? Thanks.

1 Answer 1


There is no filter hook to customize comment edit fields on admin page. However you can hide those two fields using CSS, add the code below on your active theme.

function wp_ste_remove_commentfields() {
    global $pagenow;
    if ( $pagenow != 'comment.php' ) return;
        .editcomment tr:nth-child(2),
        .editcomment tr:nth-child(3) {
            display: none;
add_action( 'admin_print_styles', 'wp_ste_remove_commentfields' );
  • Thanks, but I'm not looking for a CSS/JS solution that would remove the fields on the frontend. Looking for PHP code that doesn't load the fields on the page.
    – sgro
    Commented Oct 23, 2021 at 19:40
  • @sgr12 Have you even tried to look at the code in wp-admin/comment.php? There is no filter or hook to customize those fields :), however this code will not hide the fields on the frontend, unless the fields have the same class name. Commented Oct 25, 2021 at 0:32
  • Yes, I have looked at the code and know the limitations; it's a hard one. Know of any plugin/external code that allows customizable comment moderation for authors that bypasses the wp-admin/comment.php form?
    – sgro
    Commented Oct 25, 2021 at 17:31
  • Hi @sgr12 that file is part of the core, modifying the core can have all kinds of unintended consequences, like preventing updates from working correctly, further screwing up an installation. Commented Oct 26, 2021 at 2:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.