• Resolved Oslaf

    (@oslaf)


    Hello; I’ve bumped into a little problem:

    I currently use two kind of search forms in my site, one for general, site-wide searchs, and other for specific blog search. I’m employing the usual hidden field on my custom form in order to control the search and exclude pages and the rest of my custom post types:

    <input type="hidden" name="post_type" value="post" />

    I’m using the plugin to extend the search to several custom taxonomies and meta fields (which works great), but now the search parameters gets ignored, and every form returns the same (untrimmed) results even when the URL still displays the parameter. Any ideas?

    https://www.mysite.com/?s=my+search+in+the+blog&post_type=post

    https://www.ads-software.com/plugins/wp-extended-search/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Sumit Singh

    (@5um17)

    Hello Oslaf
    Because plugin search settings are global and overwrite WordPress default behavior, in this case you can disable plugin behavior by filters for any one search form.
    use this hidden field for anyone form where you do not require meta search or taxonomy search

    <input type="hidden" name="disable_wpes" value="1" />

    and put this in function.php

    function wpes_enabled($wpes_enabled) {
        return FALSE;
    }
    if (isset($_GET['disable_wpes']) && $_GET['disable_wpes']) {
        add_filter('wpes_enabled', 'wpes_enabled');
    }

    get details about more filters here

    Thread Starter Oslaf

    (@oslaf)

    Hi again; thanks for your quick reply.

    That does the trick, but it obviously disables the extended search completely for that form, and I did want to still extend the search to default taxonomies (categories and tags) and some meta fields in the blog post searches.
    Plus, it creates a visible URL parameter which can be manually tweaked by the user…

    I thought a solution would be possible and simpler to achieve, since the Search Everything plugin does keep the manual search parameters. I’d rather use your plugin, though, since yours is actually way more versatile (and SE is cartoonishly cluttered with pointless options and ads)

    Plugin Author Sumit Singh

    (@5um17)

    Hello,

    Thank you for your nice comment. I believe that i missed that feature, it will take few days to update the plugin. I’ll update this feature in trunk and will let you know once it is available to download.

    Plugin Author Sumit Singh

    (@5um17)

    Hi,
    Plugin is updated to support post_type parameter you can download the development version here https://downloads.www.ads-software.com/plugin/wp-extended-search.zip

    Thread Starter Oslaf

    (@oslaf)

    Cool, thanks again. I’ve been using a simple pre_get_posts action to fix the issue (had to give it a ridiculous priority to make sure it actually overrided WPES, though). I’ll get rid of it with the next version of WPES then.

    if ( $_GET["post_type"] == 'post' && $query->is_main_query()  ) {
    	$query->query_vars['post_type'] = 'post';
    }
    Plugin Author Sumit Singh

    (@5um17)

    Great!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Preserve hardcoded search arguments’ is closed to new replies.