Custom search for a custom post type in WordPress

Change operator to IN: array( ‘taxonomy’ => ‘features’, ‘terms’ => $feature_slugs, ‘field’ => ‘slug’, ‘operator’ => ‘IN’, ), That will query posts that have any of the terms in $feature_slugs, rather than all of the terms, which is what AND does. Also, I can see you’re using the POST method for this search. That type … Read more

How to change URL structure for custom post type in wordpress? Custom taxonomy + custom Post name [duplicate]

I think you have to create your own rewrite rule for that custom post type. Example creating a rewrite rule : function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘reviews/(.+)/(.+)’ => ‘index.php?post_type=movies&taxonomy_name=”.$wp_rewrite->preg_index(1).”&post_name=” . $wp_rewrite->preg_index(2) ); $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( … Read more

I cannot display custom posts in custom taxonomy

try this code : function custom_taxonomy_m_product_category() { register_taxonomy(‘m_product_category’, [‘m_product’], [ ‘hierarchical’ => true, ‘labels’ => $labels, ‘show_ui’ => true, ‘show_admin_column’ => true, ‘exclude_from_search’ => **false**, ‘query_var’ => true, ‘public’ => true, ‘hierarchical’ => true, ‘rewrite’ => [‘slug’ => ‘cat-slug’, ‘with_front’ => true ], ]); }

Why is my loop not populating the page with my custom taxonomy terms from my custom post type?

You need to specify the post type in argument and need to use the taxonomy tag properly. You can try the following args variable. $args = array( ‘posts_per_page’ => 10, ‘post_type’ => ‘series’, //Specify the post type here ‘paged’ => $paged, ‘tax_query’ => array( array( ‘taxonomy’ => ”, //specify the taxonomy name ‘field’ => ‘slug’, … Read more

Change Search display for Custom Post Type

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.