[resolved] Scheduling post allows viewing if url known (33 posts)

  1. valuxes
    Posted 7 years ago #

    Scheduling posts is working for me, only too well...

    I was shocked to discover today that even though I schedule a post to be published at a later date, a reader can still view the post if he/she knows the url, which can be more or less easily guessed since I follow a pretty consistent permalink structure.

    This effectively makes the schedule post feature useless as far as scheduling press releases under NDA (Non Disclosure Agreement) which stipulates that a press release cannot be published until a certain date and a certain time -- usually midnight or some unearthly hour when we should be sleeping :).

    So, what I am resorting to doing now to prevent accidental viewing of a scheduled post is to append it with some gobbledygook characters so the permalink cannot be guessed. Then, go in later, after publication, and edit out the offending characters. Not an elegant solution at all since I'm changing permalink...

    Anyone has a solution / plugin for this? Thanks in advance!

  2. Mark / t31os

    Posted 7 years ago #

    Doesn't do that here...

    I was half convinced you were right, so i went and created a post (scheduled), then opened up ie (i develop under firefox) and plonked the scheduled post URL into the address bar, immediately i got my site with a 404 page not found...

    Did you test this logged out? or get another user to confirm?...

    I'm on 2.8.2 ...

  3. hpguru
    Posted 7 years ago #

    Please log out and post should give a 404 error.

  4. Mark / t31os

    Posted 7 years ago #

    Can you confirm if that was the problem valuxes?

  5. anabelle
    Posted 6 years ago #

    And what if you need logged out users to be able to se scheduled posts?

    I need them to be able to see them if the know the url, currently they are getting a 404 error.

    How can I avoid this?

  6. valuxes
    Posted 6 years ago #

    t31os_, hpguru,

    Once I logged out, it gives 404 -- pheeew!

    Thanks, guys.


  7. valuxes
    Posted 6 years ago #


    It's working as it should: scheduled posts should stay hidden until the date/time desired.


  8. anabelle
    Posted 6 years ago #

    I know it's working as it should, but I want to override that behaviour and let logged out users visit future posts if they know the url.

    How can this be done?

  9. Can't. Otherwise everyone would be able to see the posts, and at that point, you may as well just ... post it. Yannow?

  10. anabelle
    Posted 6 years ago #

    I'm using the date as a Tour date for my band, so i'd love I post a post as future when the show is in the future And in past when the show has already passed.

    I know the upcoming posts, and the gig plugin do this. But I rather do it without plugins.

    Also "Can't" is not a common answer when talking about wordpress, I know this can be done, I just don't know how.

  11. Good point. You CAN, but you can't the way you're saying.

    See, the best I can think of is that you'd have to edit the loop on your front page, such that it wouldn't show posts that were posted after 'now', and then you'd have to edit your previous/next link code to do the same. And then you'd actually publish your posts and they'd be 'hidden.'

    Except I can't fathom what good that would do, and it's a LOT of extra work to 'hide' posts that you want people to see.

    Why are you trying to hide them?

  12. anabelle
    Posted 6 years ago #

    I'm not trying to hide them, I guess i didn't make myself clear.

    I already created a custom loop with "post_satus=future" I don't need pagination yet so I'll keep it simple.

    The "future" loop is working ok, except that when a visitor clicks on a link, they get a 404 error.

    I just want to avoid the 404 and allow visitors to see future posts using the permalink.

  13. anabelle
    Posted 6 years ago #

    Im okay with past posts showing up, thats the idea, to keep al info about a show in a single post.

    So after the show passed I could add videos and photos of how was it. Keeping the date accurate

  14. I'm not trying to hide them, I guess i didn't make myself clear.

    Clearly :D

    What are you trying to achieve with this?

    If you're planning to have one post for each event, and update the post where the event is updated (news, etc), then ... why not just post that? You could use catagories like 'Upcoming' 'Current' and 'Past' and then filter by that. Heck, get fancy and use a jslider or something to cycle through what's coming up. Then change the category when it changes status.

    I guess if I understood your end goal, I (and others) might have a better suggestion.

  15. anabelle
    Posted 6 years ago #

    I'll put it in one sentence.

    I need logged out users to be able to see future posts if they know the permalink instead of getting a 404 error.

    Thats all.

    Thank you!

  16. So ... you don't want posts to show up on the front page of your blog, but you do want them available? Or is there something specific about the post dates that requires them to be 'future' posts?

  17. anabelle
    Posted 6 years ago #

    I want them to show in the homepage, i've already done that.

    Yes they need to be in the future.

    I just want to disable the 404 error for future posts.

    Thanks again

  18. Ah, okay, my miss-understanding stemmed from not getting that when you said 'future' posts what you meant was you want to be able to publish posts with a date in the future, as opposed to schedule them.

    Try this plugin: http://wordpress.org/extend/plugins/no-future-posts/

    If you use that in conjunction with a little category tweaking, you should get the desired effect.

  19. anabelle
    Posted 6 years ago #

    I don't mean to be rude, but as I said before "I rather do it without plugins."


  20. design_dolphin
    Posted 6 years ago #


    You could give a post a password. You don't want to give out accounts to people? (That's understandable, no prob) then I would consider the post password route. Although somebody could post this on the web, would that be a problem? Or is this a select group who probably won't do this? You could also give access through for example IP addres through for example .htaccess if you are running on a Apache server. However if someones IP addresses changes (i.e. traveling) then they won't be able to view it. What you are proposing sounds very complicated see the IP address explanation. Or am I making it more difficult than needs be?

    As for adding (new) info to gigs. You might also go the route of:

    Category: Gig A
    child category: Stories
    child category: Videos
    child category: Foto's
    child category: Fan page


    Category: All videos
    and have video also marked with this category. In other words multiple categories for a single post.

    This would allow people to get updates through the feed or visiting the site, instead of for you having to change the post, and people not knowing it has updated (or it being unclear).

    Hope it helps. :-)

  21. anabelle
    Posted 6 years ago #

    Thanks for your ideas!

    Still looking how to disable 404 error for future posts.

  22. Sorry, crossed between your posts and valuxes (the latter of which asks for plugins) :)

    What's wrong with a plugin, out of curiosity? It's likely to be your best bet at avoiding the 404 error.

  23. anabelle
    Posted 6 years ago #

    It's just that I had bad experiences with plugins that become unsuported, or they don't keep up with wordpress versions.

    Also, as I'm delivering this site to a cliente, i don't want to be tied to a plugin.

    What is it that those plugins do to avoid the 404? Can't it be one via functions.php?

  24. I'm fairly sure that the 404 is caused by the nature of WP, and the plugin probably has a way around it. If you don't want to use someone else's plugin, you may have to bite the bullet and study it to see if you can extract the part that circumvents the 404. :/ It may make for a lot of work.

  25. anabelle
    Posted 6 years ago #

    "I'm fairly sure that the 404 is caused by the nature of WP, and the plugin probably has a way around it."

    That's what I think. I've already opened some plugins but I can't find it.

  26. jblifestyles
    Posted 6 years ago #

    If I was your client I would be pretty upset that your trying to hack up some of the functionality of a wordpress site.. (FYI, you probably won't be able to update wordpress without losing this functionality).

    You can go with Ipstenu's plugin suggestion, or, as I would prefer.. go the route suggested by design_dolphin with creating categories for the Tour Dates and just associating any posts, etc.. under that category.

    The category method requires very little configuration, and makes a hell of a lot more usability sense than having your client constantly revise a post (they are just adding a post, which updates that tour date "category" page with new info), having users see a post that looks like it was written in the future (confusing), etc...

  27. anabelle
    Posted 6 years ago #

    Keeping my client (and this specific project) aside,

    I'm not trying to hack wordpress, Functionality won't be lost cause I'm not looking into modifying core files.

    Suggestion by design_dolphin is ok. And a great idea.

    I'll repost the original question because I'm still looking for an answer.

    ┬┐How can I disable the 404 error for future posts?

  28. jkovis
    Posted 6 years ago #

    I think I'm trying to do something similar for a client (school event calendar) and was able to put this filter together (add to your theme's functions.php):

    add_filter( 'wp_insert_post_data', 'event_calendar_save_post', 10, 2 );
    function event_calendar_save_post( $data, $postarr ) {
    	// specify the category that you want to disable "Scheduled" posts for
    	$events_category = get_option('ec3_event_category');
    	$category_match = false;
    	// run through all the post's categories and look for a match
    	foreach($postarr['post_category'] as $category) {
    		if($category == $events_category) {
    			$category_match = true;
    	// check if the post is in the specified category and if it's a "Scheduled" post
    	if($category_match && $data['post_status'] == 'future') {
    		// change the post from "Scheduled" to "Published"
    		$data['post_status'] = 'publish';
    		return $data;
    	return $data;

    All posts under the specified category and published with a future date will not be subject to WP's "Scheduled" post feature. Instead, they will appear as "Published" posts (with future published dates).

    You can add more categories to the foreach loop if you want, or remove the category requirement all-together (remove if statement and brackets).

  29. helene_paris
    Posted 6 years ago #

    Solution here :

    Allows everyone to see future posts.

  30. valuxes
    Posted 6 years ago #


    Maybe this may also help:



Topic Closed

This topic has been closed to new replies.

About this Topic