OK, let’s try to find this filter in WP code…
In wp-includes/template.php
you can find this:
function get_single_template() {
$object = get_queried_object();
$templates = array();
if ( ! empty( $object->post_type ) ) {
$template = get_page_template_slug( $object );
if ( $template && 0 === validate_file( $template ) ) {
$templates[] = $template;
}
$name_decoded = urldecode( $object->post_name );
if ( $name_decoded !== $object->post_name ) {
$templates[] = "single-{$object->post_type}-{$name_decoded}.php";
}
$templates[] = "single-{$object->post_type}-{$object->post_name}.php";
$templates[] = "single-{$object->post_type}.php";
}
$templates[] = "single.php";
return get_query_template( 'single', $templates );
}
And at the end of get_query_template
the filter is applied like so:
return apply_filters( "{$type}_template", $template, $type, $templates );
So, as you can see, the filter is called with some default templates passed as param. And this means that your condition wont be true:
function myevent( $template ) {
if ('event' == get_post_type(get_queried_object_id()) && !$template) {
// the part with !$template will be fals, so this code won't run
$template = dirname(__FILE__) . '/single-event.php';
}
return $template;
}
add_action( 'single_template', 'myevent');