Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created August 1, 2017 14:49
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 billerickson/2aad7c960adbd68328c7f6b4351c354f to your computer and use it in GitHub Desktop.
Save billerickson/2aad7c960adbd68328c7f6b4351c354f to your computer and use it in GitHub Desktop.
<?php
/**
* Include pages in category/tag archive query
*
**/
function be_archive_query( $query ) {
if( $query->is_main_query() && ! is_admin() && ( $query->is_category() || $query->is_tag() ) {
$query->set( 'post_type', array( 'post', 'page' ) );
}
}
add_action( 'pre_get_posts', 'be_archive_query' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment