Title: wp_schedule_event &#8211; Creating PHP script
Last modified: August 18, 2016

---

# wp_schedule_event – Creating PHP script

 *  [wtd](https://wordpress.org/support/users/wtd/)
 * (@wtd)
 * [19 years ago](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/)
 * Morning/Evening All.
 * 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.

Viewing 2 replies - 16 through 17 (of 17 total)

[←](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/?output_format=md)
[1](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/?output_format=md)
2

 *  [madteckhead](https://wordpress.org/support/users/madteckhead/)
 * (@madteckhead)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/page/2/#post-557219)
 * Hi,
    Interesting thread. I am looking to bulk import data from a local db (via
   RSS or something) and format it as posts to save in the wordpress database. Has
   anyone got ideas on how to write a script (pref. using wordpress functions) to
   add posts? I’d like it to be made a plugin, and for it to periodically check 
   the remote RSS feed.
 * Any ideas appreciated.
 * Nathan
 *  Thread Starter [wtd](https://wordpress.org/support/users/wtd/)
 * (@wtd)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/page/2/#post-557220)
 * thanks asido, i had seen that before and checked it when writing my import script.
 * I was using a standard hook publish_future_post as my callback, so bit bummed
   that it doesn’t work 🙁 oh well i’m gonna keep on plugging away at it!

Viewing 2 replies - 16 through 17 (of 17 total)

[←](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/?output_format=md)
[1](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/?output_format=md)
2

The topic ‘wp_schedule_event – Creating PHP script’ is closed to new replies.

## Tags

 * [cron](https://wordpress.org/support/topic-tag/cron/)
 * [php](https://wordpress.org/support/topic-tag/php/)
 * [wp_schedule_event](https://wordpress.org/support/topic-tag/wp_schedule_event/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 17 replies
 * 5 participants
 * Last reply from: [wtd](https://wordpress.org/support/users/wtd/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/wp_schedule_event-creating-php-script/page/2/#post-557220)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
