Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8606867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:12:04+00:00 2026-06-12T03:12:04+00:00

I’m reading the code of cron.php in wp-includes and spawn_cron() seems to be the

  • 0

I’m reading the code of cron.php in wp-includes and spawn_cron() seems to be the one which actually executes registered tasks.

The last two lines of the function:

$cron_url = site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron );

wp_remote_post( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );

It simply opens wp-cron.php passing a task an as a query argument.

The description of the API at the top of cron.php:

* Schedules a hook which will be executed once by the WordPress actions core at 
* a time which you specify. The action will fire off when someone visits your
* WordPress site, if the schedule time has passed.`

My question is that let’s say the visitor opens one of the pages of the site and then the registered task is fired by the cron API. And if the task is heavy and takes several minutes to complete, does the visitor gets a page that is not completely loaded until the task finishes?

[Edit]
To clarify what I’m asking, the question is, does the WP Cron API run tasks after the page loading completes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T03:12:06+00:00Added an answer on June 12, 2026 at 3:12 am
    $cron_url = site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron );
    wp_remote_post( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
    

    With the below sample plugin, I confirmed that the above code (I quoted in the question as well) is the one actually calls scheduled tasks. It sets 0.0.1 timeout and accesses to wp-cron.php. This means if there are 100 tasks it takes 1 seconds to load all tasks. So it has a slight impact on the page loading speed. But it seems to be something not to worry about too much.

    <?php
    /* Plugin Name: Sample Cron Task */ 
    
        // I used `heavy` because this code was initially written to test how it affects the server response if a heavy task is registered as a cron job. So forget about the naming.
    add_action('admin_menu', 'sample_cron_heavy_task');
    function sample_cron_heavy_task() {
        add_options_page(
            'Sample Cron Heavy Task', 
            'Sample Cron Heavy Task', 
            'manage_options',
            'sample_cron_heavy_task', 
            'sample_cron_heavy_task_admin');
    }
    function sample_cron_heavy_task_admin() {
        ?>
        <div class="wrap">
        <?php
            wp_schedule_single_event(time(), 'my_action_name');
            $cron_url = site_url( 'wp-cron.php?doing_wp_cron=' . $doing_wp_cron );
            // executes the registered task immediately 
            wp_remote_post( $cron_url, array( 'timeout' => 0.01, 'blocking' => false, 'sslverify' => apply_filters( 'https_local_ssl_verify', true ) ) );
            echo get_option('sample_cron_heavy_task');
        ?>
        </div>
        <?php
    }
    
    add_action('my_action_name', 'myevent'); 
    function myevent() {
        $msg = date('Y m d h:i:s A') . ': the cron task is called.<br />';
        update_option('sample_cron_heavy_task', $msg);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I used javascript for loading a picture on my website depending on which small
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I would like to run a str_replace or preg_replace which looks for certain words

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.