Skip to content

Instantly share code, notes, and snippets.

@kingkool68
Created January 9, 2019 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingkool68/24518945edd301e405fe80705c6605e3 to your computer and use it in GitHub Desktop.
Save kingkool68/24518945edd301e405fe80705c6605e3 to your computer and use it in GitHub Desktop.
<?php
function action_pre_get_posts( $query ) {
if ( $query->is_tax() && $query->is_main_query() ) {
$meta_query = array(
array(
'key' => 'date',
'compare' => '>=',
'value' => date( 'Ymd' ),
),
);
$query->set( 'meta_query', $meta_query );
}
}
add_action( 'pre_get_posts', 'action_pre_get_posts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment