wp_insert_post call not working in my code with Quick Cache
-
I am using Cron to run a php script that creates a new post on my site using Quick Cache Pro.
When I directly call the php url, the script works perfectly. One new post with the proper content is created on my site.
However, when I run it from Cron (site hosted on GoDaddy) the php code doesn’t appear to work. The post is not created. Strangely, if after the the Cron job runs and the post does not appear, I can directly run the script for the direct URL and TWO posts will be created. It is almost like the first one was stuck in the cache and then was flushed out when I manually ran the script.
I have isolated the problem to Quick Cache. If Quick Cache is present, the Cron job fails. If Quick Cache is deactivated, the code works.
My code is quite simple:
require_once("wp-config.php");
$time=date('F j, Y');
$my_post = array(
` ‘post_title’ => “Goofy title $time”,
'post_content' => "$contents",
'post_status' => 'publish',
'post_author' => 1,
'post_category' => array(538,679)
);
wp_insert_post( $my_post );
Any suggestions on what I am missing?
- The topic ‘wp_insert_post call not working in my code with Quick Cache’ is closed to new replies.