How to show only Standard Format post in my custom taxonomy page -wordpress 3.8.1

Looking at your comment, photos and videos aren’t custom post types but actually categories. I’m changing my answer to reflect your comment.

You can use pre_get_posts to exclude specific categories in your loop. You can achieve that with $query->set( 'cat=-1,-2,-3' ); This will exclude categories with ID’s 1, 2 and 3, and will only show categories with ID’s other that 1, 2 and 3.

Just remember, to exclude categories, you have to use the minus(-) sign in front of the category ID.

Here is the complete code that should go into your functions.php to exclude your categories on your taxonomy page

function exclude_category( $query ) {
    if ( !is_admin() && $query->is_tax() && $query->is_main_query() ) {
        $query->set( 'cat', '-1,-2,-3' );
    }
}
add_action( 'pre_get_posts', 'exclude_category' );

Leave a Comment