Hello @edpetit ,
We do have an option to exclude the current post from here.
But, I have inspected your blog page and it seems like it is a static page as a blog page. Please refer to this screenshot.
It seems like you have used the Post Grid block on pages with Post Type – Post.
In this case, the Exclude Current Post option takes a current page ID for excluding. And due to the page ID, the current post does not exclude.
If you used the Post Grid block on post pages. On that post page, the post grid gets the Current Post ID and it works. But if you want to use on Pages you need to use the following filter to exclude post by ID.
However, I would love to take this as a suggestion. I’ll put forward your thought about this to our team and if feasible we will try to improve the scenario in our future updates.
Meanwhile, you can exclude posts from the Post Grid block using the following filter.
To do that please follow the following steps:-
- To apply different filters for a specific block you need to add a unique class to the block from the Advanced Tab of Post Grid Block.
- You need to get the post IDs of the Pages or Posts you want to exclude.
- After that, you need to add the following filter in your child theme’s functions.php file.
function filter_post_query( $query_args, $attributes) {
// Unique class name added from Advanced tab for Post Grid.
if ( 'my-post-grid-class' == $attributes['className'] ) {
// 123 and 456 is the post id you want to exclude.
$query_args['post__not_in'] = array( 123,456 );
}
return $query_args;
}
add_filter( 'uagb_post_query_args_grid', 'filter_post_query', 10, 2 );
I hope that helps. Let me know how it goes.
Regards,
Sweta