Hello @bozzmedia ,
To exclude all posts from a specific category. Please use below custom code –
function filter_post_query( $query_args, $attributes) {
// Unique class name added from Advanced tab for Post Grid.
if ( 'my-post-grid-class' == $attributes['className'] ) {
// 1 is the category id you want to exclude.
$query_args['category__not_in'] = array( 1 );
}
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
See here how to get category ID from here.
For the Post Masonry block:
Similarly, just like the above step, you have to first add unique classes to each of the blocks from the Advanced Tab of Post Masonry Block.
After that, you can use the following code:
function filter_post_query( $query_args, $attributes) {
// Unique class name added from Advanced tab for Post Masonry.
if ( 'my-post-masonry-class' == $attributes['className'] ) {
// 1 is the category id you want to exclude.
$query_args['category__not_in'] = array( 1 );
}
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
I hope that helps.
Regards,
Sweta