Support » Plugin: Bop Search Box Item Type For Nav Menus » First result is wrong on some searches

  • Resolved candyg333

    (@candyg333)


    Love this plug-in, but having problems on some pages. For example, when I go to my home page and do a search, for example, “Amiens”. It pulls up several links, but the first one only takes you back to the search button. The next one down is the one that should pull up. I have noticed this on several pages, but not sure if it occurs randomly on all pages or not.

Viewing 1 replies (of 1 total)
  • Plugin Author joe_bopper

    (@joe_bopper)

    Hi Candy,

    Pleased to hear you like the plugin. Sorry to hear you’re having problems.

    I’m afraid you’re issues aren’t actually to do with this plugin. This plugin doesn’t affect the WordPress search algorithm and so doesn’t give different results to a default WP search box.

    That said, it seems from the example you gave that your gallery plugin (Envira) has a poorly defined custom post type in its code. You can tell from the url for the first link that it is trying to get a post of the envira type.

    Here’s a link to help with restricting search post types (both globally and per search box): https://wptheming.com/2015/11/limit-search-form-to-specific-post-types/

    If you just wish to do it with this search box only, the following code in your theme’s functions.php should do it:

    do_action( 'bop_nav_search_hidden_inputs', function( $item, $depth, $args ){
      ?>
      <input type="hidden" name="post_type[]" value="destination">
      <input type="hidden" name="post_type[]" value="cruise">
      <!-- etc. -->
      <?php
    } );

    Hope this helps.

    Cheers,
    Joe

Viewing 1 replies (of 1 total)
  • The topic ‘First result is wrong on some searches’ is closed to new replies.