Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8006099
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T17:24:09+00:00 2026-06-04T17:24:09+00:00

I’ve been asked to fix a problem on a wordpress site. The problem is

  • 0

I’ve been asked to fix a problem on a wordpress site. The problem is caused by the fact posts should of been used instead of pages. However the site is up and running and quickest option would be to fix the problem using a hack of sorts.

The site has an events section, each event is a page (this is the issue, should really be a post). In order to have upcoming and past events the post date is used, therefore upcoming events has a post status of ‘future’.

There’s are list page of events which shows them fine by using the correct query_post(). Although the problem arises when you click through to actual event (which is a future page). If your logged in as an Admin then the page shows but if your not logged in you get a 404 page.

Now if they where posts then the “The Future is Now!” plugin would solve this problem. I have a feeling the only way round the problem is to rewrite part of core WordPress files.

Any advice would be great, I have a lot of experience with WordPress so even if you can point me in the right direction.

Cheers,
Jason

[Update]

Thanks maiorano84 for your detailed response. In the long run I intend to move them to posts but in the meantime they’ve requested we fix it asap without changing any urls (today they sent out a mass email with a list of events without checking any links)

Your solution of including post_status future doesn’t work in this case as wordpress doesn’t get to the stage of loading the template. Something in wordpress core stops it from getting that far. Ideally if they was a hook I could use to override this behavior in the meantime that would be excellent but if it comes to it I will temporarily edit the core files.

[Update 2]

I now know the two functions that need editing or use a hook that relates to them.

First of we is_404() which needs changed to not add future pages as 404

Second we have is_page() need to return true if a page is future

[Update 3]

I’ve found how to do this in the core. If you go to wp-includes/query.php line 2682. Copy this in instead of the old function it works correct. If you have a better way please let me know. Thanks.

        /** Future Pages **/
    // Check post status to determine if post should be displayed.
    if ( !empty($this->posts) && ($this->is_single || $this->is_page) ) {
        $status = get_post_status($this->posts[0]);
        $post_status_obj = get_post_status_object($status);;
        if ( !$post_status_obj->public ) {
                if  ( $post_status_obj->protected ) {
                        $this->is_preview = true;
                        print_r($status);
                        if ( 'draft' != $status ) {
                            $this->posts[0]->post_date = current_time('mysql');
                            } else {
                            $this->posts = array();
                        }
                } elseif ( $post_status_obj->private ) {
                    if ( ! current_user_can($read_cap, $this->posts[0]->ID) )
                        $this->posts = array();
                } else {
                    $this->posts = array();
                }
        }
        /** END **/
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T17:24:11+00:00Added an answer on June 4, 2026 at 5:24 pm

    You can actually add a post_status parameter of ‘future’ to your page queries. You REALLY shouldn’t be modifying your core files in order to do what you want. So on your page.php and archive.php templates (or other relevant templates that’s controlling your Event display), you can do something like this:

    <?php
    $params = array('posts_per_page'=>-1, 'post_status'=>'publish,future');
    $query = new WP_Query($params);
    if($query->have_posts()) : while($query->have_posts()) : $query->the_post();
    ?>
    <!-- YOUR PAGE HTML HERE -->
    <?php
    endwhile;endif;
    wp_reset_postdata();
    ?>
    

    This is an oversimplification, but using the correct queries in the corresponding files will allow you to display your pages however you like.

    More information here: http://codex.wordpress.org/Class_Reference/WP_Query

    Another thing worth considering, and I realize that this wasn’t a part of your question, but may very well solve your issue:

    Why not create a subdomain on your client’s server where you can work on fixing everything without interrupting the user experience? You can easily either import the existing database into your development environment, and make all the changes you need without affecting the live version.

    Food for thought. My advice would be to nip this in the bud, and convert the pages over to posts as soon as possible, otherwise the website will turn into a giant mess very quickly, but that’s your call.

    Hope this helps.

    UPDATE:

    I would still advise against altering the core files, but if it’s a last resort until everything gets fixed, then have at it. Here’s is a “WP Friendly” solution I think might help:

    add_action('wp','future_redirect', 0);
    function future_redirect($WP_Object)
    {
        $page = is_page() ? get_page(get_the_ID()) : false;
        if($page && $page->post_status == 'future')
        {
            wp_redirect(/*YOUR REDIRECT URL*/);
            exit();
        }
        return $WP_Object;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I have a French site that I want to parse, but am running into
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I have a bunch of posts stored in text files formatted in yaml/textile (from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I am using parse_ini_file to read the contents of a file however it is

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.