WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] 404 redirect future posts (2 posts)

  1. YouON
    Member
    Posted 1 year ago #

    In one of my site I display future posts via WP_Query correctly, but when you click on the permalink you are redirected to 404 page.

    Normal users cannot view the single page of future posts, is possibile to correct this via function.php (I don't like core hacks)?

    I hope you will understand my problem, sorry for my english :(

  2. YouON
    Member
    Posted 1 year ago #

    ok with a little bit of more research I found this inside a plugin http://wordpress.org/extend/plugins/show-future-posts-on-single-post/

    add_filter('the_posts', '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;
    }

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags