Site logo

Archived topic

Using BOP plugin for search in Nav menu

2 replies · Started by CRISTO on March 9, 2017

Viewing posts 1–3 of 3

I mentioned earlier how easy this was to install on my site. One problem I found was that sometimes the first resut shown after a search was not valid...it took you to a "page not found". After asking the plug-in author, he suggested that there was a conflict with Envira Gallery that was causing this. His advice was to add this to the php files:

// Change search function globally to search only post, page and portfolio post types
function prefix_limit_post_types_in_search( $query ) {
if ( $query->is_search ) {
$query->set( 'post_type', array( 'post','page', 'portfolio' ) );
}
return $query;
}
add_filter( 'pre_get_posts', 'prefix_limit_post_types_in_search' );

I used the "Code Snippets" plug-in someone here had suggested and it worked like a charm. Not a GP related problem, but just in case anyone has the same situation, this is a solution.

Awesome, thanks for sharing! :)

Thanks to whoever mentioned "code snippets" plug-in as well.....it was super easy.

This archived topic is closed to new replies.