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
- Taxonomy question how to add more data
- How to get a custom taxonomy slug in body classes
- How to: Easily Move a WordPress Install from Development to Production?
- Is there a flowchart for WordPress loading sequence?
- Essential technical features for high-end WordPress web hosting? [closed]
- Is There a Difference Between Taxonomies and Categories?
- How to remove admin menu pages inserted by plugins?
- How to put logs in WordPress
- How to get the Date Format and Time Format settings for use in my template?
- Where are Additional CSS files stored
- Best Practices for Regression Testing WordPress Websites?
- Remove wrapping div and ul from output of wp_nav_menu
- Attaching taxonomy data to post with wp_insert_post
- What Is The Use Of map_meta_cap Filter?
- get post author id outside loop
- Custom Walker: how to get ID in function start_lvl
- Creative uses of WordPress [closed]
- How to *remove* a parent theme page template from a child theme?
- How do I make my child theme re-apply the settings that were customised when its parent was active?
- Multiple Inputs in a Customizer Control
- New WP_Customize API – how does it work under the hood?
- Embedding a SOAP Client into a WordPress Plugin?
- Is there anything that Joomla or Drupal can do that can’t be done in WordPress? [closed]
- Update widget form after drag-and-drop (WP save bug)
- Data sanitization: Best Practices with code examples
- How to benchmark a WordPress installation? [closed]
- Should I delete the default themes?
- Moving WP install from local to live, what about wp_posts GUID?
- Modified wp.media.view.Settings.Gallery in Backbone JS, but editing doesn’t work
- Running Gutenberg React in Development Mode
- Prevent WordPress from automatically installing a new theme each year
- Can we use one WordPress installation for multiple databases, domains and content directories
- Is there a blank theme framework compatible with WP 3.0? [closed]
- Plugin SVN & update API – how are plugins identified?
- Users with custom roles not showing in post author select box
- How to use more than 256MB of memory in the admin?
- How do I query by post format in WordPress 3.1
- How do register_sidebar() and get_sidebar() work together?
- How do you get formatted content of a post using the WordPress API?
- How do I append multiple taxonomies to the URL?
- Localization: I want the backend: english and frontend in defined language
- Are there any forks of WordPress (and what is different about them)?
- How to Change 404 page title
- Make Custom Metaboxes Collapse by Default
- WordPress Paginate $wpdb->get_results
- Custom maintenance page
- Add button to TinyMCE bar without creating a plugin