Skip to content

Instantly share code, notes, and snippets.

@vfontjr
Created May 2, 2020 13:53
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 vfontjr/214ea5b35a42909452bed056201c1e56 to your computer and use it in GitHub Desktop.
Save vfontjr/214ea5b35a42909452bed056201c1e56 to your computer and use it in GitHub Desktop.
<?php
function filter_video_format_posts($query) {
/* change 999 to the page id for your archive page */
if ( !is_page ('999') )
return $query;
$taxquery = array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => array( 'post-format-video' ),
)
);
$query->set( 'tax_query', $taxquery );
}
add_action( 'pre_get_posts', 'filter_video_format_posts' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment