WordPress.org

Ready to get started?Download WordPress

Forums

WP 2.2x and 2.3x differences scheduling posts (4 posts)

  1. srp0uk
    Member
    Posted 6 years ago #

    Hi,

    I am working on a little plugin, and developed it on some wp version 2.2x

    It creates a number of posts with post_status = 'draft' and a blank date.

    Once all the posts are loaded, it then publishes some of them with todays date and post_status = 'publish'.

    The rest of them are given future dates and post_status = 'future'.

    All the manipulations are done using the wp_insert_post function. This works fine using version 2.2x and I get, say, half the posts posted today, and the others stepped over several weeks.

    When I try and do this on version 2.3x I find that the posts are not scheduled properly, the first refresh of the blog shows the ones set to 'publish' but then the very next refresh shows the future posts. They still have the future dates, but their status has been set to publish by the refresh - telling me that the post schedule wasn't set up properly.

    In 2.2x I notice that wp_schedule_single_event is called in wp_insert_post, but this appears to be no longer the case in 2.3x.

    How, and why, has this been replaced, and how can I use the standard API to change existing post dates and status and make sure they are published in future correctly?

  2. srp0uk
    Member
    Posted 6 years ago #

    I got around this by loading the posts into a giant array, and loading them with their intended dates and status first time, instead of putting them as drafts into the posts table first.

    However, the issue still stand about converting drafts to future using the API...

  3. srp0uk
    Member
    Posted 6 years ago #

    Are there any issues with WP2.3x's incorrect updating of categories?

    As mentioned above, I succussfully added posts using wp_insert_post, future ones WERE successfully scheduled for the future, as the future dates come and go the new posts get published BUT the category counts don't update as this happens.

  4. pickledegg
    Member
    Posted 6 years ago #

    srp0uk, have you had any success posting to categories using wp_insert_post? No matter what I try they always go into the default category, NOT what I specify.

Topic Closed

This topic has been closed to new replies.

About this Topic