WordPress.org

Ready to get started?Download WordPress

Forums

Help with cron job to schedule time delayed posts (21 posts)

  1. talia
    Member
    Posted 5 years ago #

    Hi there

    I have set up my cron job in bluehost standard cron job manager to run hourly BUT any time I do a post with a future date or time it posts immediately. I have no idea why.

    According to the bluehost help guide I only need to enter the file name and timing to run the job which I have done. I know the job must be activating as prior to installing the cron job the posts didn't publish at all. I have set the job to run hourly

    I have edited the time of the post and pressed save and it publishes immediately. The same happens if I press publish.

    Here is my cron.php file. I thought I'd check that this is the latest and is correct, in case there is some error in the code that is causing it to publish immediately

    Thanks

    [contents of wp's cron.php removed]

  2. BernardBorealis
    Member
    Posted 5 years ago #

    Don't know if these will help, but there are several suggestions in these topics, some of which worked for some people and not for others: http://wordpress.org/support/topic/165238?replies=72
    http://wordpress.org/support/topic/163152?replies=13

  3. talia
    Member
    Posted 5 years ago #

    thanks bernard i will take a look at those threads

  4. talia
    Member
    Posted 5 years ago #

    I took a look and none of those solve my problems

    Can someone please advise me why all my posts publish immediately even if it is scheduled for a future dated time?

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

    talia: WordPress does not need any cron job to work properly. It has it's own internal system, called wp-cron to handle this stuff.

    What external cron job did you set up anyway? There is nothing to hit from a normal external cron process.

  6. talia
    Member
    Posted 5 years ago #

    hi otto42

    i set up cron.php as a job

    before i did that the posts didn't publish at all. they would get to the scheduled time and say they were x minutes old but never publish

    i am using fantastico on bluehost

    initially someone (you i think?) said the problem was that the job wasn't scheduled in the cron job manager so i set it up. since doing that all posts publish immediately no matter what time i schedule them for

    how do i fix this please?

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

    i set up cron.php as a job

    LOL. Okay, that would not actually *do* anything, because cron.php, by itself, does nothing at all. It just defines a bunch of functions. Running alone, it will do nothing whatsoever. :)

    before i did that the posts didn't publish at all. they would get to the scheduled time and say they were x minutes old but never publish

    I guarantee you that running cron.php did not cause this to occur.

    how do i fix this please?

    First, you might as well get rid of that cron job and then see what happens.

    Second, make sure that you're doing things correctly. A lot of people seem to be confused by how it works, but I don't understand why. To future publish, you set the date and time and then click "Publish". It won't show up until that time rolls around.

    If it's not working, then you need to carefully describe what happens. Details are important here.

  8. talia
    Member
    Posted 5 years ago #

    Otto: I have now deleted that job as you suggest.

    If it's not working, then you need to carefully describe what happens. Details are important here.

    1. I went into write a new post
    2. I typed up a post with "test" in body and heading
    3. Next to publish immediately, select "edit"
    4. Add 5 minutes to the time that it has in there (i.e. 5 mins from when i started the post)
    5. Click publish
    6. The screen now says Your post has been saved. View post | Edit post. The post has disappeared from the screen
    7. Click VIEW POST shows the post on the blog, published at the time I selected (ie 1145), even though the five minutes are not up

    I tried a second time and added 1 hour and 5 mins to the post. Exactly the same problem

    I tried a third time and added 1 day to the post time. Exactly the same problem. It posts immediately. Very frustrating!!!

    Your help is appreciated as I have 2 other blogs I want to convert to wordpress but have held off until I can fix this problem.
    Thanks

  9. talia
    Member
    Posted 5 years ago #

    Hmmm this is weird. I have now checked the dashboard, as I planned to edit the posts

    Post #1 says it was published 6 mins ago test — Private
    Post #2 says it was published 59 mins ago test 2 — Private
    Post #3 says it was published 24 hours ago test 1 day — Private

    How can that be? Post #3 is dated 7 November at 23:45
    It seems to be reversing the time. I don't get this at all.

    So I did a 4th post dated 1 week from now, 2008/11/13 test 1 week — Private

    It has also published immediately but it shows the future date in the dashboard

  10. BernardBorealis
    Member
    Posted 5 years ago #

    Just as a note. When you click "View Post" it will always show you your post, no matter what time stamp you put on it. If you want to find out if your post truly published or not, never click view post. Go visit your site instead.

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

    Click VIEW POST shows the post on the blog, published at the time I selected (ie 1145), even though the five minutes are not up

    Yeah, I think you might be getting confused here. You can always view the post on your blog. It's your post, of course *you* can see it.

    But if you actually go look at the main blog, is it really there? Just because you can see it directly means nothing.

  12. talia
    Member
    Posted 5 years ago #

    YES of course the post is on the main site. I wouldn't be here if they didn't!!! I've deleted them now but if I go to the blog section they all show up

    As an experiment I did another post and added a day to the time in the post. It shows up immediately in the blog and on the sidebar listing of recent posts dated 9 November.

    I'll do a couple of screen shots for you in a moment

  13. talia
    Member
    Posted 5 years ago #

    Hi again Otto and Bernard

    http://whydietsdontworkclubmembers.com/images/wddw-wp1.jpg
    In this you can see that the screen capture from today (8 November) but it says the post dated 9 November was posted 24 hours ago.

    http://whydietsdontworkclubmembers.com/images/wddw-wp2.jpg
    Shows the test posts are on the blog now even though they are dated 9 and 15 November 2008.

    No reason for them to appear. And odd that it seems to do the inverse. If the post is scheduled to appear in 5 minutes time it says it's 5 mins old. If it is scheduled in a hour it becomes an hour old, and if scheduled in 24 hours it says it was published 24 hours ago

    Weird!

  14. flick
    Member
    Posted 5 years ago #

    I've just tested this feature again just to make sure (2.6.x) and from what I can tell, if you are still logged in as admin, the test posts *will* still appear when viewing the main blog/site, but as pointed out before, will be post-dated.

    However, if one were to view the site whilst as a visitor/not logged in (I use a separate browser for testing) the post will not appear until the published date arrives.

    As for the 'date' under "Manage", my test post shows the date that the post should be published (I set it for the 14th of Nov in this case)

  15. talia
    Member
    Posted 5 years ago #

    Hi Mosey
    Thanks for that suggestion. I know I have logged out and checked the posts the first time I was testing this but not recently

    I will try testing a few posts and then logging out to see what shows on the screen!

  16. talia
    Member
    Posted 5 years ago #

    I think I've worked out what the problem is and it looks like it is a wordpress bug

    If I tick the private posts box, it posts immediately no matter what time or date is on the post

    But if I don't tick the private posts box so they are public then it works fine and schedules the posts

    This must be a bug????

    I'd appreciate it if someone else could test the private versus public post options to see if that is what is screwing this up! Also, I am on 2.5.1 so maybe this is fixed in a later version?

    The private posts seem to have an inverse relationship with the time scheduling function

    Says it was posted 24 hours ago but it was scheduled to post 24 hours from now
    24 hours ago test 1 day from now — Private

    Says it was posted 53 mins ago but it was scheduled to post 1 hour from the post time
    53 mins ago test 1 hour from now — Private

    Says it was posted 3 mins ago but it was scheduled to post 5 minutes from the post time
    3 mins ago test 5 minutes from this time — Private

  17. flick
    Member
    Posted 5 years ago #

    I can confirm (for 2.6.x) that if a post is set to be 'Private' and the admin clicks on 'Publish' , even if it is scheduled for publishing later, it will show up on the main site immediately for the admin if they are logged in. The post will be post-dated.

    If however, the admin clicks on 'Save' instead of 'Publish' after changing the date to the future, the status of the post will change to 'Published', and the post will not show on the site for the admin until the scheduled published date.

    For both scenarios, the post is not available to visitors to the site at any time.

    If the post is set to 'Public', then it does not show on the site (even if the admin is logged in) until the published date.

    @Talia: I'm not sure if this is a bug or just a display feature, but although I agree it can be confusing, hopefully it is reassuring for you that the scheduled posts won't show up before time for the visitors on your site. As far as I understand it , Private posts are supposed to remain 'private' to the admin/author.

    I recently watched a screencast by Mark Jaquith, which I think shows how WP are addressing this postential confusion in 2.7.

  18. talia
    Member
    Posted 5 years ago #

    I'm not sure if it is a display error or a bug but it's not working. Personally I think it is a bug.

    The private posts show up in the sidebar for a user that is not logged in to the site. That means that they are still "displayed" as published for users who are not logged in. If the post isn't scheduled to go up for a week it shouldn't be in the sidebar. Period. Given the way the sidebar widget works I'd have to assume it is NOT a display error but instead that the post IS published as far as wordpress is concerned.

    People get an error message when they try to view the posts saying they need to log in, but they shouldn't show at all.

    On the dashboard, the posts are showing as aging inversely to the time they have been on the site. If a post is scheduled to go up in 5 mins it shows as 5 mins old, if it scheduled to go in 1 hour up it shows as 1 hour old on the dashboard. This is likely a display error as they show in the correct order and times on the blog, but I think displaying them under most recent posts must be a bug.

    Going back to the discussion we've been having in the other thread on members only sections, other people must also be having this issue unless they are publishing all their posts immediately.

    I don't think that the fix for 2.7 addresses this issue. Private posts that are scheduled 5 mins from now or 5 days from now shouldn't be showing in the recent posts list for non-admin readers

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

    You could have said that you were doing private posts from the beginning, you know.

    This is a known issue, 2.7 does not fix it.

    See: http://trac.wordpress.org/ticket/7745

    Short version: Private posts are always published. This has to do with the internals of private posts, and there is no way to future publish something that is private.

  20. flick
    Member
    Posted 5 years ago #

    Thanks for the clarification, Otto :) I had assumed that (from the screencast) that steps had been taken to address the issue (or at least clarify the options) Clearly, I was wrong.

  21. talia
    Member
    Posted 5 years ago #

    You could have said that you were doing private posts from the beginning, you know.

    This is a known issue, 2.7 does not fix it.

    See: http://trac.wordpress.org/ticket/7745

    Short version: Private posts are always published. This has to do with the internals of private posts, and there is no way to future publish something that is private.

    It never occurred to me that wordpress treats them differently. I like to go in once a week and schedule everything.

    I'll look at the role manager workaround to restrict who can see some posts, but I think I've already looked at it and found it had some flaws for a membership based blog

Topic Closed

This topic has been closed to new replies.

About this Topic