How to hide trackbacks on wp-admin/edit-comments.php

How to hide (or not to show, better said) trackbacks on wp-admin/edit-comments.php page?

I want to hide the comments with no email (also known as trackbacks) and comments with a specific email from the edit-comments.php page.

Related posts

Leave a Reply

2 comments

  1. While this is not impossible, this is very likely to have ton of edge cases and backfire in some. In a nutshell comments are retrieved with comment query, which can be adjusted with something like this (if in admin and comment type not specified then only fetch normal comments):

    add_action( 'pre_get_comments', 'exclude_pings' );
    
    function exclude_pings( $comment_query ) {
    
        if( ! is_admin() )
            return;
    
        if ( empty( $comment_query->query_vars['type'] ) )
            $comment_query->query_vars['type'] = 'comment';
    }
    

    However the problem is “any comment query in admin” is too broad and there isn’t much it can be narrowed down by.

    Overall I would not recommend to mess with this.

    PS excluding by author is not supported by native arguments and would be even more tricky with need to filter SQL.

  2. To only show comments on the comments page.
    Above the list there are 2 dropdowns one has the option to only show comments.

    I checked the file which builds the data: class-wp-comments-list-table.php And the function prepare_items. It has no filters or actions to hook into.

    As far as I can tell there is no way to disable trackbacks from showing.
    Nor is excluding certain emails.

    If you really want it you would have to copy the comment screen, and edit that.
    I can help you get started with that if you want.