I am trying to run a script when a user publishes / updates a post.
I am using the filter: wp_insert_post_data
The problem I am having is the script is a php file outside of WordPress but on the same site (It works fine if i go direct to it) that just needs to be run. I tried to include the file using the filter but that stopped the post being updated for some reason.
This is my current code:
function updateFeed( $data , $postarr) {
include 'jobsfeed.php';
return $data;
}
add_filter( 'wp_insert_post_data' , 'updateFeed' , '99', 2 );
Is there any way to be able to run this script?