I need to call custom php script when I publish new post in WP. This function works, but include not. It is not included. Can it be working or is there any other way to include php file in functios.php?
function new_post_caller( $ID, $post ) {
include( get_template_directory() . 'call_new_post.php?ID='.$ID.'' );
}
add_action( 'publish_mypost', 'new_post_caller', 10, 2 );