• 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)
  • 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

    (@wtd)

    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)
  • The topic ‘wp_schedule_event – Creating PHP script’ is closed to new replies.