0

My users aren't able to see scheduled posts. Instead they get shown a 404 error. I'd like to show scheduled posts as well.

  • 4
    Please elaborate on your question, this way it's poor standard - see: Help: How to Ask. Like I mentioned on your other question wordpress.stackexchange.com/questions/117240/… you are maybe not getting the concept of scheduled posts - they will be visible after the scheduling time, because then they will be published. – Nicolai Oct 9 '13 at 11:06
  • 1
    I suspect that you are trying to use scheduled posts for something they are not meant for. Please explain the actual problem/project that you are working on. – s_ha_dum Oct 9 '13 at 14:50
2

If you want to display the scheduled posts in the main wordpress loop you can use 'post_status' => 'future' as an argument for the array. This will now show your scheduled posts for all users. It's pretty handy for things like event listings.

However there is a problem with this and I believe this is what your problem may be. When any user with a role set lower than editor, or a non-user, tries to access that post on it's individual page you will not have the rights to view it, and it throws up a 404.

Not sure why this is and why admins and editors can see it.

If you place this code in your functions.php file it should get it working for everyone.

    /* Show future posts */
function show_future_posts($posts)
{
   global $wp_query, $wpdb;
   if(is_single() && $wp_query->post_count == 0)
   {
      $posts = $wpdb->get_results($wp_query->request);
   }
   return $posts;
}
add_filter('the_posts', 'show_future_posts');

I found it from this post on Wordpress

http://wordpress.org/support/topic/display-future-post-on-single-pageview

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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