I made the following because of an error, does it look ok?
function filter_bbp_get_view_query_args( $args, $view ) {
// Check if the view exists
if ( function_exists( 'bbp_get_view' ) ) {
if ( ! bbp_get_view( $view ) ) {
return new WP_Error( 'invalid_view', __( 'Invalid view specified.', 'bbpress' ), $view );
}
}
if ( 'popular' === $view ) {
$args['date_query'] = array(
array(
'after' => '1 week ago',
),
);
}
return $args;
}
add_filter( 'bbp_get_view_query_args', 'filter_bbp_get_view_query_args', 10, 2 );