Filter my home page posts by category or by tag

You can use the following code to list the posts that are categorized under category id 3 OR have tag ‘urgent’

function exclude_category($query) {
    if ( $query->is_home ) {
        $query->set( 'tax_query', array(
            'relation' => 'OR',
            array(
                'taxonomy' => 'category',
                'field' =>  'ID',
                'terms' => 3
            ),
            array(
                'taxonomy' => 'post_tag',
                'field' => 'slug',
                'terms' => 'urgent'
            )
        ));
    }
    return $query;
}
add_filter('pre_get_posts', 'exclude_category');