I have managed to solve my issue. I add code and comments below in case anyone finds this post an the answers/code below help them.
First John, thanks for coming back to me and you’re right it was not an issue relating to your plugin.
For the xdebug thing, I added this below, so that I could be sure my breakpoints would be hit. This adds a query arguement to the URL
add_filter( 'cron_request', 'wp_cron_debug', 10 );
function wp_cron_debug( $args ) {
$args['url'] = add_query_arg( array(
'XDEBUG_SESSION_START' => 'PHPSTORM' // <== replace PHPSTORM with your key
), $args['url'] );
return $args;
}
This was not helpful, nothing really happened as a result of doing the above so I carried on trying to figure out what was happening. Debugging through the WP Crontrol plugin I noticed that the cron_request timeout was really low, something like 0.001, so after some further googling I discovered some actions + filters that allow me to adjust the length of the curl request process.
add_action('http_api_curl', 'custom_curl_timeout', 9999, 1);
function custom_curl_timeout( $handle ){
curl_setopt( $handle, CURLOPT_CONNECTTIMEOUT, 10 ); // 30 seconds. Too much for production, only for testing.
curl_setopt( $handle, CURLOPT_TIMEOUT, 10 ); // 30 seconds. Too much for production, only for testing.
}
// Setting custom timeout for the HTTP request
add_filter( 'http_request_timeout', 'custom_http_request_timeout', 9999 );
function custom_http_request_timeout( $timeout_value ) {
return 10; // 30 seconds. Too much for production, only for testing.
}
// Setting custom timeout in HTTP request args
add_filter('http_request_args', 'custom_http_request_args', 9999, 1);
function custom_http_request_args( $r ){
$r['timeout'] = 10; // 30 seconds. Too much for production, only for testing.
return $r;
}
Finally my breakpoints were being hit