Hook
Change WP Query (pre_get_posts)
add_filter( 'pre_get_posts', 'custom_wp_query' ); function custom_wp_query( $query ) { if ( ! is_admin() && $query->is_main_query() ) { if ( is_archive() ){ if ( !is_tax( 'your_tax' ) && !is_404() ){ $query->set( 'post_parent', 0 );//any valid query attribute } if (!is_post_type_archive()) { $query->set( 'post_type', array('post', 'page', 'a_custom_post_type') );//any valid query attribute } } } return $query; }