I have read/searched a ton of questions but all I find seem to be related to custom post types and such.

The situation is that sometimes we happen to have a lot of posts waiting for to be published and I would like to preferably only show posts to a week from now (so all posts before strtotime("+1 week")) but if that's not plausable, I would like to filter out all posts by status "future" from the edit.php "all" view.

Can someone help me out?

function hide_future_scheduled($wp_query) {
    global $pagenow;
    if ($pagenow == 'edit.php') {
        $wp_query->set(WHAT CAN I PUT IN HERE TO DO THIS);
add_filter('parse_query', 'hide_future_scheduled');

Thanks in advance.

1 Answer 1


The question pretty much got covered in another thread here.

In case anyone else need anything like this I ended up using following code to hide all the posts that are over a week in the future.

function hide_future_posts($where, $q) {
    if(is_admin() && $q->is_main_query() && !filter_input(INPUT_GET, 'post_status') && ( $screen = get_current_screen() ) instanceof \WP_Screen && 'edit-post' === $screen->id) {
        global $wpdb;

        $where .= sprintf(" AND {$wpdb->posts}.post_date <= ( '%s' )", date('Y-m-d', strtotime('+1 week')));
    return $where;
add_action( 'posts_where', 'hide_future_posts', 10, 2 );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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