Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
    
you do want them enabled on the frontend? –  janw Sep 27 '12 at 8:10
    
I want them to be shown on frontend, but not shown on the edit-comments.php and on the Dashboard widget named Recent Comments. –  kingbt Sep 27 '12 at 8:20

2 Answers 2

up vote 0 down vote accepted

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.

share|improve this answer
    
This helped me because I did not want to show trackbacks and a comment type named order_note (that has a specific repetitive email and author name). Thanks a lot and have a nice day. –  kingbt Sep 27 '12 at 12:09

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.

share|improve this answer
    
You should leave this as a comment rather than an answer to keep the discussion in the same context. –  Brian Fegter Sep 27 '12 at 9:56
    
Thanks, but I don't like hacking the core. Maybe a future version of WP will allow filters for this. –  kingbt Sep 27 '12 at 11:58

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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