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' );
Related Posts:
- Custom taxonomy: same terms, but for different years
- Post format selector in Thematic child theme post class
- get_terms return errors
- Reproducing hierarchical list output from wp_list_categories(), using get_categories()
- Fast way to add countries as a custom taxonomy term?
- Add URL field to the link post format
- Is there a filter hook that I can use to change how taxonomy term names are displayed?
- How to Register and Display Widget for Custom taxonomy
- Show Custom Taxonomy Slug(s)?
- Custom Taxonomy Archive not displaying entries
- Exclude custom taxonomy tag from loop
- Hide custom field if empty
- Filter posts by custom taxonomy terms
- Function to remove archive sidebar for custom taxonomy?
- Automatically check parents (in a taxonomy) when child is selected
- How to add textarea field to taxonomy (tag)?
- How can I get the custom post type assigned to a current custom taxonomy for query?
- wp_query get post custom taxonomy in search.php
- How to get Related Custom Posts?
- How to get every custom taxonomy names and urls?
- Get Custom Taxonomy Terms by Date
- Display specific Taxonomy Term from Custom Post Type
- Semi complicated custom taxonomy question
- Get wordpress taxonomy slug name(s) to use as div class
- How do I list custom taxonomy terms with the links?
- Make tag archive display post are ordered by post format
- How to Render Post Types in RSS Feed?
- Echo the Last Child Taxonomy only (not parents)?
- How to query term_id of a Custom Taxonomy by name
- WordPress 3.1.2 Bug: add_theme_support() and video post format registering twice
- How to show parent taxonomy using get_the_terms?
- wp_insert_post custom taxonomy multiple Category not added
- query variables for custom taxonomies
- If Term Name Exists, Append a Unique ID to Slug
- Display all subterms of a custom taxonomy filtered by parent terms
- My list of terms of custom taxonomy displays 7 times
- Display Custom Taxonomy Name As A Shortcode
- Taxonomy template is not reading
- URL issue after setting up Custom Structure in Settings >> Permalinks
- How to assign a default/priority taxonomy to be shown in url in case two taxonomy items are selected
- Post filter with multiple checkbox taxonomy terms
- Combine Categories & Custom Taxonomy
- Custom dropdown search form that allows users to select option B based from Option 1
- issue with saving custom metaboxes fields
- Change post template the proper way
- Taxonomy template by post type
- How to loop through 1 CPT with 2 Taxonomies
- Custom terms in custom category taxonomy
- How to setup a taxonomy that can have only one post assigned to it?
- Grouped custom taxonomy query
- Create advanced portal website with sections – taxonomy usage?
- Custom Query for Taxonomy
- Adding a third custom taxonomies
- Plugin SVN & update API – how are plugins identified?
- How to use more than 256MB of memory in the admin?
- How do I query by post format in WordPress 3.1
- Custom Search Query
- Removing fields from the Media Uploader/Gallery
- When using the block.getSaveElement hook can you output different markup based on whether or not you are in the edit view or the live page view?
- Any amazing WordPress MultiSite sites? [closed]
- Add a page that appears in the backend admin that lists files to download? WP 3.3
- Multiple Queries and Excluding Repeating Posts?
- get_option issues
- How to change URL Custom Page?
- Custom column sorting in WordPress admin post table
- How to get multiple Action Hooks in an Array
- What values can we use in `formattingControls` parameter in RichText component
- What will happen to the additional CSS when the theme is updated?
- Multiple Blogs on one site. Best Practise
- Custom members area (interface/design) in WordPress, is it possible and how?
- Override database config for WordPress multiblog
- Password protected photo galleries
- How do I fix unexpected redirection of visitors after enabling multisite on WP3?
- How to get “string” away – replaced with “nothing” [closed]
- Set terms in a custom post
- Remove add news page and posts from menu
- Custom Status of Custom Post type need to EXCLUDE from Taxonomy pages
- redirect post id to post full url
- custom default avatar showing broken link
- Moving wp-content folder
- Modify the display Text of number of comments
- How to add span on WordPress Title for first and third word
- problem saving/ retrieving custom meta with wp alchemy metabox
- Problem with custom function from jQuery slider tutorial
- How to style bootstrap container in WordPress?
- Change login cookie expiration time?
- generate a static copy of the website footer html
- Multi-site customization
- Show different pages on site depending on user choice
- Is there a way to limit multi upload in media upload box?
- Use another theme template in my theme
- How to add a post with new Taxonomy without assigning to default category?
- Pulling posts into static site (wordpress as subdirectory)
- Call a duplicate registration form with other url
- How to support extra color options for shortcodes?
- WP Customizer – what types of fields is it capable of supporting?
- Pass query param to custom page
- responsive screen not working [closed]
- Multi color post title by using custom javascript inside the gutenberg editor?
- Add custom styles to the Raft theme