0

I have an ob_start(); in my header.php and ob_end_flush(); include("cron.php"); in my footer.

Now the cron.php takes a few seconds to load so it takes time for the page to render.

How come it isn't rendering considering I have flushed the output? I know browsers mess with this and in the past their have been techniques but I have tried them (eg. adding flush(); or a UTF-8 header) but none of them have worked.

Is there a solution that works or is there another way for me to accomplish this?

How does WordPress include it's cron file?

header.php:

<?php
    ob_start();
    require_once("config.php");
?>

Then there's the page code.

footer.php:

<?php ob_flush(); flush(); ob_end_flush(); require("cron.php"); ?>
  • better to show your code there. – Deep Kakkar Aug 01 '16 at 11:44
  • define( 'DISABLE_WP_CRON', true ); Next you will have to create a real server cron job to ping (I use curl) http://example.org/wp-cron.php?doing_wp_cron. You will need to check with your host or control panel documentation on how to do this. If you are command line savvy just create a crontab. $ crontab -e */1 * * * * curl -I http://example.org/wp-cron.php?doing_wp_cron This is saying that every minute I want my server to execute that command which will ping wp-cron and make it run. – Jatinder Kaur Aug 01 '16 at 11:47
  • @JatinderKaur I'm not actually using WordPress, I was just wondering how WordPress handles this with wp_cron because they don't have loading time problems like this does? –  Aug 01 '16 at 11:48
  • check this link http://stackoverflow.com/questions/34293363/wordpress-get-option-in-external-php-file if this could help you – Jatinder Kaur Aug 01 '16 at 11:52
  • @JatinderKaur I am NOT using WordPres... –  Aug 01 '16 at 12:04
  • better to show your code here. – Jatinder Kaur Aug 01 '16 at 12:05
  • @JatinderKaur I have... –  Aug 02 '16 at 12:18
  • Anyone know what I can do? –  Aug 02 '16 at 12:19

0 Answers0