wp_schedule_event – Creating PHP script
I have written a small application that automatically inserts a number of posts straight into the wordpress database.
These are all inserted with an appropriate timestamp, at a given time every day for each of the posts I have inserted.
Now I understand for these posts to be set from a ‘future’ post to a posted post, then the time passes, I need to set up a entry in the wp_options table and can see the code, wp_schedule_event.
My problem is, I can’t work out how to use that function.
For example, I insert 70 posts, each having a time of 9am, and number 1 tommorow, number 2 tommorow, number 3 the next day etc.
Now these are all in the database, what I’m trying to do now is create a simple PHP script that goes through each of the post ID’s (I have these) and the time that it should be scheduled for (I also have these) but can’t for the life of me can’t get the script I have written to work.
Attached is a snipped to see if anything is wrong…
<?PHP require_once('admin.php'); wp_schedule_event(strtotime("Sat Apr 28 12:17:35 2007". " GMT"),'publish_future_post', array(10)); wp_schedule_event(strtotime("Sat Apr 28 12:18:35 2007". " GMT"),'publish_future_post', array(11)); ?>
This is uploaded to the wp_admin area and I run it, but nothing gets inserted.
My posts are all inserted with with ID’s from 10 to XX
Any help appreciated.
- The topic ‘wp_schedule_event – Creating PHP script’ is closed to new replies.