Hey Bruce,
Events Calendar Pro’s “related events” are retrieved by way of a function called tribe_get_related_posts(), which you can find in your Events Calendar Pro plugin files at this location:
events-calendar-pro/src/functions/template-tags/general.php
That function uses the event categories of the event—and any tags as well—to find “related” / similar events.
1. Do your events have multiple event categories, typically? This may be producing the results you are getting.
2. If you want to enforce that only one category is “searched” for related events, this may be possible by adding a filter like the following to your theme’s functions.php file:
if ( class_exists( 'Tribe__Events__Main' ) ) {
/**
* Rework the related events tax_query.
*
* @param array $args
* @return array
*/
function tribe_limit_related_posts_args_to_one_cat( $args ) {
if ( ! is_array( $args ) || empty( $args ) ) {
return $args;
}
// Remove the default tax_query;
unset( $args['tax_query'] );
$args['tax_query'][] = array(
'taxonomy' => Tribe__Events__Main::TAXONOMY,
'field' => 'slug',
'terms' => array( 'barbecue' ),
);
return $args;
}
add_filter( 'tribe_related_posts_args', 'tribe_limit_related_posts_args_to_one_cat' );
}
☝️ Something like this would reduce the searchable event categories to just the event category whose slug is “barbecue”.
We are not generally able to help with writing custom code like I did above, so you may need to further tinker and refine that code, but let me know if this helps or is even addressing the problem you described here.
Thank you!
George