I used "widget_comments_args" for changing comments query for Recent Comments, but it won't work.

add_filter( 'widget_comments_args', 'my_function_name' );
function my_function_name( $comment_args ) {
    $comment_args['post_type'] = 'post';
    $comment_args['type'] = 'comment';
    return $comment_args;
  • What output you were expecting? What did you get? I tested with the filter in your code and its working fine. Aug 24, 2014 at 4:16
  • I expected recent comments widgets doesn't show other post types comments, But it's still showing.
    – Ehsaan
    Aug 24, 2014 at 5:39


Your Answer

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

Browse other questions tagged or ask your own question.