How to execute existing WP Cron programmatically

When you register a scheduled event for WordPress’ cron, the 3rd argument is a hook name:

wp_schedule_event( time(), 'hourly', 'my_hourly_event' );

And you add a function to run on this hook with add_action():

add_action( 'my_hourly_event', 'do_this_hourly' );

This will cause do_this_hourly() to run whenever the scheduled event runs. This works because when the scheduled time occurs, your action is called like this:

do_action( 'my_hourly_event' );

Which causes anything hooked to my_hourly_event with add_action() to run. So you can run the hooked function, like do_this_hourly(), manually at any time by just manually triggering your event with do_action(), as above, such as in response to a form submission or AJAX request.

Alternatively, you can just run the hooked function directly:

do_this_hourly();