Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

On the homepage of my website I'm retrieving published and scheduled posts this way:

<?php 
global $post;
$args = array('numberposts' => '3', 'category' => $category, 'post_status' => array('publish', 'future' ));
$myposts = get_posts($args);

It works fine, but if I'm not logged in as admin I can't access the whole post. It gives me a 404 error.

share|improve this question

1 Answer 1

I assume what you are doing is pulling 3 posts, one or more of which may be 'Future' posts, displaying some kind of preview and a link to the complete post. When you click the link for 'Future' posts, you get the error.

'Future' posts are going to be blocked for people not capable of editing them, more or less the way 'Drafts' are blocked. Attempting to access those results in a 404. That is how the system works. Nothing is broken here. Nearly everything can be overridden but why would you schedule a post and then try to display it before its scheduled time?

share|improve this answer
    
It's a website I built for an organization. They public news and upcoming events, so they want to display also future posts and I thought scheduled posts worked as I expected them to, but I was wrong. So, is there a neat way to do what I need? –  Carlo Oct 18 '12 at 13:54
    
No, 'future' posts aren't a 'calender' feature. You will need to look in the Plugin Repo for 'event' plugins, probably, or write your own scheduler, or use a third party service. –  s_ha_dum Oct 18 '12 at 14:04
    
ok, thank you. That's what I needed –  Carlo Oct 19 '12 at 7:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.