These need to match, but don't:
apply_filters( 'document_template', $path, $template );
and
add_filter( 'documents_template','my_template', 10, 2 );
document_template
!= documents_template
Otherwise, everything looks correct.
Edit
Wait, not everything looks correct. I don't think you want to add a parameter to your callback function definition. Instead, you need to define $template
within the callback, or simply pass it back unmodified. So, replace this:
function my_template( $template = '' ){
...with this:
function my_template(){
e.g.:
function my_template(){
$path = MY_INCLUDES_DIR . '/document/'. $template;
return $path;
}
add_filter( 'documents_template','my_template', 10, 2 );
Edit 2
Okay, minor mistake on my part. Try this as your callback:
function my_template( $path, $template ){
$path = MY_INCLUDES_DIR . '/document/'. $template;
return $path;
}
add_filter( 'documents_template','my_template', 10, 2 );