Forums

[resolved] 404 redirect future posts (2 posts)

  1. YouON
    Member
    Posted 7 months 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 7 months 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;
    }

Reply

You must log in to post.

About this Topic

Tags