Display attachment, post and page in recent comments widget

It does seem that you are already using a custom function that you found from this site. You should credit the original author of that code.

The widget_comments_args filter was introduced in WordPress3.4. This filter is poorly documented. This filter uses get_comments(), so you can also use the same parameters. Here is the filter in wp-includes/default-widgets.php#L847

847                 /**
848                  * Filter the arguments for the Recent Comments widget.
849                  *
850                  * @since 3.4.0
851                  *
852                  * @see get_comments()
853                  *
854                  * @param array $comment_args An array of arguments used to retrieve the recent comments.
855                  */
856                 $comments = get_comments( apply_filters( 'widget_comments_args', array(
857                         'number'      => $number,
858                         'status'      => 'approve',
859                         'post_status' => 'publish'
860                 ) ) );

There is a problem though in get_comments() as it only accepts one post type, not an array or a string which is actually quite funny. There is away around this.

One of the members of the site @birgire has written a plugin called wp-comments-from-mulitple-post-types to add the ability to get_comments and WP_Comment_Query() to accept multiple post types. You can download his plugin here

After installation, you can now use your code like this

function wpse80087_widget_comments_args( $args ) {
    $args = array( 
       'number' => 5, 
       'post_type' => array('attachment', 'post',' page'),
     );
    return $args;
}
add_filter( 'widget_comments_args', 'wpse80087_widget_comments_args', 10, 1 );

EDIT

It seems that from feedback from the OP that either status or post_status is not working and only returns one post type. When these parameters are removed, everything works as expected. See the updated code above

error code: 523