wp-cront doesn't execute for custom events
-
Hi,
I have scheduled some custom event in my website and for some reason the events don’t execute. The code I have used is the following:function ztest_add_pages(){ // Add settings page for users who can edit plugins add_dashboard_page('ztest','ztest','publish_pages', "ztest_settings",'ztest_daily_schedule'); } add_action('admin_menu', 'ztest_add_pages'); function ztest_installation() { /* do some db initialisation stuff */ if ( !wp_next_scheduled( 'ztest_daily_schedule' ) ) { wp_schedule_event(time(), 'daily', 'ztest_daily_schedule'); } } // Create tables on plugin activation register_activation_hook( __FILE__, 'ztest_installation' ); function ztest_uninstall() { wp_clear_scheduled_hook('ztest_daily_schedule'); } register_deactivation_hook(__FILE__, 'ztest_uninstall'); function ztest_daily_schedule() { /*doo some stuff, e.g. db queries etc*/ }I have installed also the wp crontrol (https://wordpress.org/plugins/wp-crontrol/) plugin and I can see that the event is registered properly. However whenever I use the http://mywordpres.com/wp-cron.php?doing_wp_cron or I just press the run button from the wp crontrol plugin for my specific event nothing happens. However whenever I schedule a new post to be published in the future then everything runs properly. I know for sure also that my code runs as I have checked it through the custom page I have created.
Furthermore, looking at the internet there were some other issues such as caching mechanism, hosting companies etc, but none of this is a problem for me. I have even tried it in totally new installed wordpress and for any custom wp cron event I create it doesn’t run.
Any help, ideas?
The topic ‘wp-cront doesn't execute for custom events’ is closed to new replies.