Snippets: Exclude Current Post from Any Total Grid/Carousel Module

// Exclude Current Post from Any Total Grid/Carousel Module
add_filter( 'vcex_query_args', function( $args, $atts ) {
	if ( wp_doing_ajax() ) {
		$current_id = url_to_postid( wp_get_referer() );
	} elseif ( function_exists( 'vcex_get_the_ID' ) ) {
		$current_id = vcex_get_the_ID();
	} else {
		$current_id = get_the_ID();
	}
	$args['post__not_in'] = array( $current_id );
	return $args;
}, 10, 2 );

Snippet Type: PHP

All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)