WordPress.org

Ready to get started?Download WordPress

Forums

Schedule a post to be published at a future date: Does not work (79 posts)

  1. animator
    Member
    Posted 7 years ago #

    Hello,

    Sometimes i need to write an article or post and schedule it to be published at a future date.

    I know that this feature works in WP by editing a post's Timestamp and put a future date/time there.

    Unfortunately, this doesn't work for me. When the right time comes, nothing is published.

    In Dashboard i can see all Scheduled Entries. When current time passes the timestamp, all Scheduled Entries are not published, but still appear in dashboard, showing how much time has passed from the poststamp time to now (weird)

    Any ideas to help?

  2. MichaelH
    Member
    Posted 7 years ago #

    What is the Post Status?

  3. animator
    Member
    Posted 7 years ago #

    The post status is "Published"

  4. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Try accessing http://example.com/blog/wp-cron.php . See if that forces them to publish. If so, then the problem is likely that the cron process cannot automatically run. Several things could cause this..incorrect DNS settings on the server, incorrect info in the url's on the options->general page, etc.

    Also remember that it won't actually post until somebody accesses your blog itself (not the admin pages, the live blog). If nobody looks at the blog, nothing will happen.

  5. Choco-cookie
    Member
    Posted 7 years ago #

    Otto42: I can hit that page in my WP install and get a nice blank page, no apparent errors. I have other cron processes running on my blog (postie for moblogging) without a hitch.

    This future posting problem worked prior to one of the last few WP updates. I've been with WP since version 1.x, and future posting my little heart out without a hitch until I'd guess 2.1 something-or-other came out.

    I'm going to guess (right or wrong) that there was a change deep down in the WP code that killed this feature.

    It's almost as if WP can't move 'published' (since the entry is in the database, it is considered published) entries from "future" and hidden from view, to "live" for the world to see.

    If it was just a matter of hitting wp-cron.php, heck, I could live with that, but, sorry, it's more then that.

  6. animator
    Member
    Posted 7 years ago #

    wp-cron.php doesn't force them to publish

    DNS is checked OK
    info in general page is checked OK

    the feature of Scheduled publishing does not work.

    i made experiments with the timezone offset too (put no offset, put +2, put -2) but nothing happened either.

  7. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    @Choco-cookie:

    Otto42: I can hit that page in my WP install and get a nice blank page, no apparent errors. I have other cron processes running on my blog (postie for moblogging) without a hitch.

    Postie uses a different type of cron, not the same thing at all. Unless you're using "cronless postie".

    I've been with WP since version 1.x, and future posting my little heart out without a hitch until I'd guess 2.1 something-or-other came out.

    2.1 added the new wp-cron.php functionality. What you suggest supports my argument, that your wp-cron is not working correctly.

    It's almost as if WP can't move 'published' (since the entry is in the database, it is considered published) entries from "future" and hidden from view, to "live" for the world to see.

    a) That's *not* what "published" means. Drafts are in the database too.
    b) When the post_status field changes from "future" to "publish", *then* is is published. Not before. And wp-cron is what makes that happen, as of 2.1 and up. wp-cron does several other things too (pingbacks, trackbacks, etc).

    If it was just a matter of hitting wp-cron.php, heck, I could live with that, but, sorry, it's more then that.

    No, you're *not* supposed to hit wp-cron yourself. WordPress does that all by itself. However, if it cannot for various reasons, then you would see the same sort of symptoms you are both describing.

    Running any weird plugins? Anything not explicitly listed as 2.1 compatible?

    @animator:

    the feature of Scheduled publishing does not work.

    If you're going to make silly blanket statements like this, then you can just solve your problem yourself. The fact is that future publishing *does* work, I do it all the time. It's not working *for you*, so please confine yourself to sane and rational discourse on this forum. Okay?

  8. Choco-cookie
    Member
    Posted 7 years ago #

    (I'm using an actual cron job to use postie, but that's not the point here...)

    If wp-cron.php changed in version 2.1, and I don't need trackback, pingbacks, or anything other then posting, is just reverting to a prior version of this one file a potential fix? Or has the way WP uses wp-cron.php fundamentally changed to the point only a new version works (or doesn't work, whatever the case may be)?

    And if I'm not getting any errors when hitting wp-cron.php, how does one trouble shoot that it's not working correctly? There isn't any feedback to go off of, like "yeah, you did it!" or "boo! error 5 million & 72, failure"? I checked my host server error logs and hit had nothing to go on either. Bummer.

  9. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    If wp-cron.php changed in version 2.1, and I don't need trackback, pingbacks, or anything other then posting, is just reverting to a prior version of this one file a potential fix? Or has the way WP uses wp-cron.php fundamentally changed to the point only a new version works (or doesn't work, whatever the case may be)?

    Fundamental deep change, so no, you can't revert just part of it.

    And if I'm not getting any errors when hitting wp-cron.php, how does one trouble shoot that it's not working correctly? There isn't any feedback to go off of, like "yeah, you did it!" or "boo! error 5 million & 72, failure"? I checked my host server error logs and hit had nothing to go on either. Bummer.

    wp-cron.php never returns anything. That's not what it's supposed to do. It's more of a background process, it has no output.
    You can get some information based on the time it takes to run.. If it returned quickly, then it didn't find any work that it had to perform, so it stopped processing right away. If it took a while, then maybe it had stuff to do.

    If you have phpMyAdmin, you can see some of the various tasks it has scheduled in the options table (under the "cron" key). I would not modify this data, but you can at least learn something from the names of the things in the data.

    Of course, if it has no data there, then it's not expecting to have to do anything in the foreseeable future.

  10. animator
    Member
    Posted 7 years ago #

    @ Otto42:

    My friend thank you for your help so far.

    You misunderstood my statement, it was only for my situation and not general. I love WP and most of all i love all people that trying to help, like you. I also try to help others sometimes too.

    But statements like yours :"If you're going to make silly blanket statements like this, then you can just solve your problem yourself." are very aggressive and do not fit to my behaviour or personality!

  11. Choco-cookie
    Member
    Posted 7 years ago #

    OK, since we're here... yeap, I have phpmyadmin (my host loves me I guess)

    Option ID 164,
    option value a:2:{i:1180476345;a:1:{s:19:"publish_future_post";a:1:{s:32:"7e4251348df5ebeea43a212b0d548ef8";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{i:0;i:2734;}}}}s:7:"version";i:2;}

    Funny enough, the "doing cron" has an option value of 0.

  12. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Funny enough, the "doing cron" has an option value of 0.

    That's normal. That means it's not doing cron at this exact moment. :)

    Option ID 164,
    option value a:2:{i:1180476345;a:1:{s:19:"publish_future_post";a:1:{s:32:"7e4251348df5ebeea43a212b0d548ef8";a:2:{s:8:"schedule";b:0;s:4:"args";a:1:{i:0;i:2734;}}}}s:7:"version";i:2;}

    Well, it looks like you do have a future post scheduled, but it's not time for it to be published yet. That timestamp translates to Tuesday, May 29th 2007, 22:05:45 (GMT), which is in about 6 hours or so.

  13. Choco-cookie
    Member
    Posted 7 years ago #

    Otto42, why yes I do have a test post scheduled for that time! I'm glad someone can read that :)

    I also have one scheduled to post at a date/time of May 28, 2007 @ 22:34, which unfortunately was last night.

    Dashboard seems to be holding the scheduled entries hostage!! (really need to whip it into shape, moosh! moosh!)

    Personally, I'm getting a bit stumped by this. If it was just me then I would say I goofed up big time (ok, I probably did, but where oh where...), but here we have Animator struggling along with the same issue. Too bad we couldn't figure out the commonality between us, and then find a nice work-around...

  14. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    I also have one scheduled to post at a date/time of May 28, 2007 @ 22:34, which unfortunately was last night.

    Using phpMyAdmin, go find that entry in the posts table, and see what the post_status is.

    If it's still future, then I cannot explain why it didn't get changed to publish. You can go ahead and change it to "publish" and it will then show up on the blog.

  15. Choco-cookie
    Member
    Posted 7 years ago #

    Sherlock, we have a clue!

    Post date: 2007-05-28 22:34:03
    Post Date GMT: 2007-05-29 02:34:03
    Post Status: future

    Ooo!!! My sql tables doesn't know how to tell time!! :)

  16. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Hmmm... From that, I assume you're in the Eastern Time zone.

    I dunno, I cannot think of why it would not have worked. The schedule you posted doesn't show a run for that time, so it must have ran and finished without changing the post_status from "future" to "publish". But as for why, I cannot say why it would do that.

  17. Choco-cookie
    Member
    Posted 7 years ago #

    Apparently there is a light bulb missing a switch. At least we found the root of the problem, though a fix would have been super groovy.

  18. JustinRDev
    Member
    Posted 7 years ago #

    Verify that the the time is setup wrong on the SQL server by running the following query in phpMyAdmin:

    SELECT curtime( ), curdate( )

    If it's ahead by 4 hours, adjust your time in WP by -4.

    Mine says:
    curtime() curdate()
    13:18:08 2007-05-29

    I'm in Germany, so it's just a tad off - by about 6 hours... I keep mine on East Coast time to keep me in check with "home".

  19. Choco-cookie
    Member
    Posted 7 years ago #

    Time is setup correctly on the server, I have the four hour difference in WP. Somehow I need to get the SQL to change the post status from Future to Publish once the time has passed. The cron does it's thing (which was mentioned here earlier), just the post status isn't flipping over.

    And that's where we all got stumped.

  20. JustinRDev
    Member
    Posted 7 years ago #

    Sorry - it's already been a long programming day so I'm pretty fried already. (I really can't stand .Net)

    Do you have 2 servers running separately for Web and DB usage? This sounds almost as if one server is kicking properly and alerting the other, but due to time issues between the two, nothing is happening.

  21. Choco-cookie
    Member
    Posted 7 years ago #

    LOL! I pay for only one web hosting package. The site is all together there: web, sql, cpanal, email... blah, blah, blah...

    cron that I looked up earlier is in the same 'big picture' sql database for WP as the post status information, just in different tables (if I am understanding sql correctly).

    The WP latest upgrade did database upgrades with 2.2, but since everyone should have had to upgrade their databases as well (I'm not the only one, am I?), then wouldn't everyone be having this future/publish switch issue?

    I wish I had the time to do a totally fresh install, but being at work, I'm already breaking rules being here....

  22. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Okay, I'm slightly confused... If you're 4 hours off GMT, then those times were correct. WordPress stores two times with every post, one in GMT, one in your local time. That's normal, it's not an error.

    What do you think is an error above?

  23. Choco-cookie
    Member
    Posted 7 years ago #

    Um, there isn't an error from what I see in the times. Times on the server are good.

    Only error is not getting the post status to change.

    Isn't that where we are at? I thought that's where we were at... maybe it's me...

  24. Samuel Wood (Otto)
    Tech Ninja
    Posted 7 years ago #

    Okay, I just got confused by some kind of implication that it was a database time thing. It's not, the "future" doesn't change automatically. WordPress changes it when the cron job runs. Or, at least, it is supposed to do so.

  25. Choco-cookie
    Member
    Posted 7 years ago #

    I took a few (lots) of minutes and installed a second, fresh, copy of WP and a second SQL database on the server using a sub-domain. The future posting works, so I'm thinking the settings on the actual server are not a problem.

    While I would like to do an export/import of my blog to the fresh, working, version, my export file is over 5mb, and apparently there is a 2mb limit.

    I was thinking about exporting the SQL databases, but where as they are most likely the problem, I don't want to just import an existing problem (that kind of defeats the purpose).

    Does anyone know how to work around the 2mb import file limit so as to import the blog data, without using the actual SQL databases?

  26. karpidis
    Member
    Posted 7 years ago #

    I had this problem only after my restore my base after a bad upgrade to 2.2. I am back to 2.1.3 and the only thing that doesn't work is this and feed for embed videos. I don't know what to do. And you haven't answered the question how to make it work again.

  27. jummy
    Member
    Posted 7 years ago #

    I'm having the trouble with the wrong timezone as well as the scheduled posts not posting automatically despite selecting the box where I have changed the date and time for posting, and pressing publish.

    When I check my site and see the entry hasn't posted on the day it was supposed to, I access the entry and press publish again and only then does it post.

    I'm running version 2.1 and the only plugins I'm using are Spam Karma 2 and WordPress Database Backup

  28. gosuser
    Member
    Posted 7 years ago #

    Problem not solved even if i do a fresh install...

  29. gosuser
    Member
    Posted 7 years ago #

    I tried to execute directly wp-cron.php and it didn't work.
    Then i edited teh file and commented out the following lines

    #if ( $_GET['check'] != wp_hash('187425') )
    # exit;

    Now when i start wp-cron.php it WORKS! It' able to post automatically when the timestamp is reached.
    The only problem that remains is that it seems that wp-cron.php is not started automatically. In fact, if i start it, the blog is update with new posts, but it is not so if the script is not executed manually.

    Does anybody know which file calls wp-cron.php?

  30. gosuser
    Member
    Posted 7 years ago #

    SOLVED:
    With a brute hack, finally i got this feature working again. Sorry for the last 3 posts, but i'm making a lot of test and i reported each single progress.
    To solve it:

    chmod -R 775 * to set executable flag to each wp script.

    Then edit wp-cron.php and comment the following lines:

    #if ( $_GET['check'] != wp_hash('187425') )
    # exit;

    #if ( get_option('doing_cron') > time() )
    # exit;

    Then edit index.php and force the execution of wp-cron.php each time that the index.php webpage is loaded (yes i know that it will increase database calls... this is why it's a brute hack). To do so change your index.php with this one:

    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wp-cron.php');
    require('./wp-blog-header.php');
    ?>

    Now everyting should work, when the timestamp is reached && an user views your blog, it's automatically updated with new posts.

    Ps: probably there should be a better solution, but for now it works...

Topic Closed

This topic has been closed to new replies.

About this Topic