Title: Post visibility control, future
Last modified: August 31, 2016

---

# Post visibility control, future

 *  [mellett](https://wordpress.org/support/users/mellett/)
 * (@mellett)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/post-visibility-control-future/)
 * I’m trying to provide my users with the ability to see a post in advance. If 
   a post is for Feb 29, I want them to be able to see it at a certain time on Feb
   28 (say, 7pm). This is for a fitness website where people like to see the workout
   for tomorrow.
 * I don’t know if the best place to do this is in pre_get_posts and I’ve tried 
   it there but my php knowledge is limited (Java I’d be fine) and I’m getting errors
   left, right and center. I’ve tried the date_query but again I don’t think my 
   syntax is correct and I don’t have it here to put up for inspection. Any functioning
   script kiddie post would be great for me right now 🙂
 * from memory it is something similar to
    — check for main query and appropriate
   category — $today = getToday(); $date_query = array(‘before’=>array(‘year’=>$
   today(“year”), ‘month’=>$today(“month”), ‘day’=>$today(“mday”)+1), ‘inclusive’
   =>true)
 * mainQuery-set=>’dateQuery’ = $date_query;
 * yes I’m aware that the syntax is off but I’m no where near it so please don’t
   fry me 🙂
 * On another note is there a way to sandbox the wordpress instance so I don’t take
   down the entire sight while I play around with it?
 * Thanks and I’d appreciate any help
    Andy

Viewing 1 replies (of 1 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/post-visibility-control-future/#post-7121592)
 * I don’t have any functional script I can offer, but I can point you in the right
   direction. You’ll still need to struggle with correct syntax, but that is mainly
   a matter of patience.
 * You wouldn’t use WP_Date_Query directly because the query passed in ‘pre_get_posts’
   is a WP_Query object. It has its own date query syntax. [https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters](https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters)
 * What you will want to do is set the ‘date_query’ query var to a structured array
   as described in the reference.
 * You will also want to add ‘future’ the ‘post_status’ query var array.
 * The ultimate WP sandbox is a local installation of Apache with WP installed on
   it. XAMPP is a very popular package that includes PHP, mySQL (mariaDB), and Perl
   with Apache. [https://www.apachefriends.org/download.html](https://www.apachefriends.org/download.html)
 * If you use Linux, you can probably also install Apache directly from your O/S
   repository.
 * You should be able to find a step by step instruction for your specific situation.

Viewing 1 replies (of 1 total)

The topic ‘Post visibility control, future’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/post-visibility-control-future/#post-7121592)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
