Try below code
function mitgliederbereich_filter_search($query) {
global $post;
global $wp_post_types;
if ($post->post_type == "mitgliederbereich") {
$wp_post_types['mitgliederbereich']->exclude_from_search = false;
} else {
$wp_post_types['mitgliederbereich']->exclude_from_search = true;
}
}
add_filter('pre_get_posts', 'mitgliederbereich_filter_search');
Hope this helps.
Related Posts:
- Append taxonomy terms as class names in markup?
- Different Category system needed for the Custom Post Type
- Foreach loop returning more than one item when querying taxonomy
- Function to erase every post from a taxonomy
- set object terms after some some time of published post – functions.php
- update custom taxonomy custom fields
- Check that a slug is present in the get_terms request
- Assigning categories to custom post types via a front-end form; only works for native post type
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Create 2-layered dropdown menus for custom taxonomy and custom post type
- Custom Loop for custom post type. Compare by meta_value?
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- Get Custom Taxonomy ID within loop
- Custom post status not working
- clients list using wordpress
- Get custom post type by category in a page template
- Find callback function for custom taxonomy metabox
- Date archives for custom post type
- How can I add dropdown widget/box to admin post page?
- Categories under custom post types doesn’t show properly
- How do I add a custom post type to the Featured Content in twenty fourteen theme?
- Ajax filter with custom taxonomies
- Filter posts with ajax form and checkboxes
- Limiting number of custom posts shown on taxonomy page
- Custom post type loops with different page templates
- How to get only one category of custom post type?
- Get all taxonomies for all post types
- List terms from Custom Taxonomy
- WP_Query search posts by custom post type and custom taxonomy
- Order WordPress Custom Taxonomy Pages & Pagination Not Working
- Loop through posts of a custom-post-type (event) and create .ics (iCal) file?
- GravityForm: Populate Dropdown with custom post type [closed]
- How to output wordpress custom tags separated by comma?
- Custom Post Types relationships
- How to retrieve category NAME instead of ID in a function with a taxonomy custom field?
- Weird problem happening with custom taxonmy when creating/updating posts
- Insert HTML inside link in a walker
- Custom Taxonomy Permalinks Redirection
- Remove standard meta boxes from custom taxonomy
- get_posts of Custom Post Type AND Custom Taxonomy
- What’s the difference between same wp functions get_posts(); functions in different form?
- Received nothing after executing AJAX post function
- Can I list a custom post type within another custom post type in the admin area?
- Set URL link to featured image of custom post type
- AJAX load more for different custom post type loops
- On update or create post redirect to current post position in list
- I need to add endpoint for wordpress categories
- Why are taxonomy terms not saving when using custom meta boxes with radio button taxonomy selectors?
- ACF field key/value to show on taxonomy list
- Query taxonomy of taxonomy of custom post type
- Categorize custom post type
- Custom post type editor with dynamic selects, one drop down populating a second second drop down not working
- Hide a widget inside a div on specific type of post
- How to change permalink to include custom post type
- categories should be available across all custom post types
- Get term name without a foreach loop
- PHP question: how to combine syntax?
- Loop increase number
- custom post for slider
- Get custom post type categories to show up in menus
- Show current custom taxonomy
- How exclude or skip post type with get_next_post_link
- Create short URL with auto 301 redirect
- Is it possible to use array_walk() to append terms to an array of posts?
- get_terms() returns Trying to get property of non-object error for custom taxonomy
- post_content is stripping HTML when adding a new post? [closed]
- Template code to split a post and print a custom field?
- Compare Two Custom Post Types Using The Same Custom Taxonomy
- Post type Echo code is repeating on homepage
- Custom post type page with parameter
- Create a Dropdown Selector and Redirect for a Custom Taxonomy in WordPress?
- php dynamic content inside shortcode
- Get all post under custom post type grouped by custom filed value in custom taxonomy
- Title and URL Error in Breadcrumb Navigation for Custom Post Types
- How to add specific terms in a custom post type?
- Limit custom post type to the authors only on front-end!
- pagination problem listing custom post types of taxonomy in wordpress
- Create posts inside CPT post
- ACF field check value of field on all other articles
- Taxonomies are not showing in the category dropdown
- Combine multiple separate lists into one
- Show parent category and subcategory once in while loop
- Recovering data about custom post and taxonomy types
- Custom Taxonomy – fields
- wordpress does not see the correct custom taxonomy hierarchy
- The most recent post of custom taxonomy
- Show tags of custom post types in WordPress
- Post Custom & Taxonomy 404 error
- can’t see categories in appearance-menu-categories
- Values inside a custom field to determine which category posts to display
- Show Custom Post Type taxonomy term that matches custom field
- Order by custom field attribute
- Building a List of Posts grouped by custom taxonomy as the section header only to be displayed if at least one post is in that tax
- Code in custom widget queries all posts, when it should only query the current post
- Add HTML before a specific div?
- Inserting two categories
- Comments are not working on Custom Post Type
- how to display custom taxonomies in front page
- WordPress different custom tag being displayed in on tag list
- How to use wp_set_object_terms depending on page ID?