• Anonymous User 11856187

    (@anonymized-11856187)


    Hi dear community!
    These days I encountered a problem.
    I try to create a future post programmatically.

    wp_insert_post( array(
        ...,
        'post_status' => 'future',
        'post_date' => $date, /* format [ Y-m-d H:i:s ] */
        ...
    ) );

    Post is created as ‘scheduled’, but when time arrives to make post status public, it does not make it, and post remains scheduled.
    What can be the problem?

    / windows(8.1) / linux(ubuntu) / xampp / localhost /

    Thanks in advance!
    Greetings,
    Andrew.

Viewing 3 replies - 1 through 3 (of 3 total)
  • 1) You can schedule a post to be published at a future date in the post editor
    2) If you really want to do it with wp_insert_post, try to test it on a live server. Your computer doesn’t run all the time, but the server does. When it’s time to publish your post, your computer may have been be shut down at this moment, and it may have interfered with the internal mechanism used by WordPress to publish the post.

    Thread Starter Anonymous User 11856187

    (@anonymized-11856187)

    By “doesn’t run all the time” You mean that my PC is turned off?
    For example I create a post +2 minutes from this time. And I go in backend and wait/refresh page to see some changes but nothing is happening!?
    Or You meant something else?

    Thanks

    Yes its what I mean.

    In any case you should really give it a try on a real live server. Results may be different

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Programmatic future post does not work’ is closed to new replies.