Thanks!
Yes, that ‘s exactly what happens (the event post type is added to the query) as events also make use of regular post tags – so this is actually expected behaviour. What you could do though is also define the following functions:
function stick_to_posts() {
add_action( 'parse_query', 'force_post_type_to_posts', 60 );
}
function force_post_type_to_posts( $query ) {
remove_action( 'parse_query', 'force_post_type_to_posts', 60 );
$query->set( 'post_type', array( 'post' ) );
}
Then, at the top of your rm_related_posts() function (right above $tags = wp_get_post_tags($post_id)) add:
stick_to_posts();
Does that help with this?