V
V
Vitaly2018-04-02 21:15:25
WordPress
Vitaly, 2018-04-02 21:15:25

Include custom taxonomies in search results?

Good day. There is a site on wp, there is a custom post-type with its own taxonomies.
When searching for the name of the taxonomy, it does not find anything.
In the functions.php file

function myprefix_search_posts_per_page($query) {
    if ( $query->is_search ) {
        $query->set( 'posts_per_page', '7' );
        $query->set( 'post_type',array('dmw-portf','page') );
    }
    return $query;
}
add_filter( 'pre_get_posts','myprefix_search_posts_per_page' );

Here I am filtering the search output for a custom post type.
How can I include all custom posttype taxonomies in the search result?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question