I actually found out that the Cron works, just not as I expected. I refreshed the pages and called wp-cron.php (using wget) a couple of times, and I kept seeing my cron task schedule with “-X seconds“. Then I stopped for a minute or two, and refreshed the frontend page of the site, and my Cron task got called.
When it was time for the second scheduled execution, one hour later, I repeated the test. Task was due in a couple of seconds, so I waited about 10 seconds an loaded a random page: nothing happened. I waited another half a minute or so, loaded again a random page, and the task got called.
It seems that WordPress has a “relaxed” way of calling Cron jobs, which I don’t fully understand yet. Anyway, my approach was correct, my expectations were not. 🙂
Related Posts:
- Which action for triggering cron “wp”or “init”?
- wp_schedule_event in a class
- WP Cron – Run Cron after evey 15 minutes at a specific time for the next three hours
- Using wp_cron with custom time interval and the register activation hook
- WordPress scheduled task is called but not executed
- Problem creating cron job wordpress
- How Do I Make WordPress Run an Event Every Day?
- How can I change the frequency of a scheduled event?
- Hourly WP schedule, do I need at least 1 visitor hourly?
- WP Cron doesn’t save or in post body
- Is there any background process that I can run from plugin without depending on page hits on a website without affecting page-load speed?
- WordPress cron running twice
- What is minimum time interval for which a cron be scheduled?
- Will cron job run if page loaded is being served from cache?
- Use wp_set_post_terms() instead of wp_insert_post()
- Programmatically detect if wp-cron is disabled?
- How to schedule a cron job in plugin without waiting for page load request?
- How to perform a heavy and long process in cron jobs?
- WordPress daily cron is executing more frequently than once a day
- wp-cron and execution of code in is_admin() included script
- How to Trigger WP CRON at Local Timestamp?
- WP Cron being triggered but not working as expected
- wp_schedule_event() set daily, but processed every second
- Will I get an error if I try unscheduling a WP Cron scheduled task that wasn’t scheduled?
- Looking for a better way to initiate cron job
- WordPress plugin cron working only if admin is logged in
- How to make a cronjob type plugin
- wp_schedule_single_event is set correctly but sometimes not fired
- How to Run Plugin on Server Without Web Browser
- Plugin with functions inside a class & how to trigger WP CRON
- Custom recurrence not working / Wp Cron event
- How and when would I implement some code which would take data from one part of the Db and put it in another?
- WP Cron as Fast as WordPress AJAX?
- Detect each active instance of a widget
- What is the use of wp_schedule_event hook?
- Can wp_schedule_single_event be used to run background proccess?
- Call do_action() within WordPress cronjob
- Running one-off cron jobs when WP_DISABLE_CRON is true: can I hit /wp-cron.php?
- wp cron does not run when i am not logged in to wp admin
- What is the advantage of using wp_mail?
- Plugin Form Submission Best Practice
- WP 3.3 How to Add Menu Items to the Admin Bar?
- Plugin directory “Last Updated” not changed after initial commit?
- Unit tests – Dealing with dependencies
- Calling the widget id of a mult-instance widget from inside the widget?
- What is the recommended way to create plugin administration forms?
- Should I create a theme or a plugin?
- Do I need to call do_action in my plugin?
- Fatal error: Call to undefined function wp_mail()
- Does WordPress have an Browser Agent?
- How Do I Load My Action Earlier Enough?
- How to check WordPress website username and password is correct
- How to sync with plugins update after I have done manual optimizations?
- WooCommerce get Shipping Class of product from either the product id or the order after order is completed
- How to retrieve a value via get_option when the option_value is stored in a multi-dimensional array?
- Dequeue script, but still use wp_localize_script to pass vars
- I can’t find where a hook is being defined in a plugin – Easy Digital Downloads
- Filter on the_content ignores shortcodes
- Custom theme sufficient or custom plugin neccessary for this feature set?
- How to change wordpress post title?
- Replacing WordPress menu functionality with a plugin
- Check spam in custom form – akismet
- Add Admin Menu Inside Construct or Init
- get plugin directory url
- Is it possible to load plugin from console with core ?
- How to create thumbnail of different files?
- How ( and mostly at what time ) can i prevent the alternate cron from running?
- Plugin base URL
- Database for development
- PHP library that can merge stylesheet with inline style [closed]
- Admin-ajax.php appending a status code to ajax response
- comment_email hook doesn’t seem to work for comment editor field
- How can I add a field to make link nofollow to the WordPress Link Inspector Window?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- WordPress Hook for user account activation in normal Wp (not MU)
- How to check if a stylesheet is already loaded?
- How do I change the initial quantity of a product in woocommerce?
- Redirect traffic to plugin
- Where to call wp_enqueue_script in a plugin with custom template?
- How to insert data to a database table when the field is not yet created?
- using new WP_Query in save_post function alters $post
- Preview Changes button missing on custom post type page since updating to 3.4
- Show special field when correct shipping is chosen
- Custom Taxonomy to dropdown box on adminside wordpress
- On cliking add new post redirect user to a custom page first
- How To Consistently Enforce Rewrite Rule in Plugin Development
- Warning: Cannot modify header information – How to resolve this issue? [closed]
- $paged always 0 on plugin’s custom page
- do_action and add_action on two different installed plugins won’t work
- How to override gutenberg paragraph block edit property
- Create a new post using rest api and save featured image using an external image url
- wp.template() returns tags in Ajax response
- How to restrict access to image folder depending on whether product is purchased or not?
- Authorizing a plugin to call Google Analytics v4 API on wp_cron
- WordPress pre_get_posts with combined results of two queries (OR)
- Plugin directory says that my plugin it’s not availabe in Spanish, but it is
- Caching the_content calls
- Is there a way in which I can compare product id with the order id to display content on front end before placing the order? [closed]
- How to hide or rename “X” and “x-child” references in website source?
- how to use shortinit in wordpress