• Resolved teejnits

    (@teejnits)


    Hello,

    I am creating a new plugin for the wordpress search feature. Ultimately it’s a simple plugin but I need some help.

    Is there any way to intercept the value from a users search, run a statement on it, if the statement returns false then pass the value back to the standard WordPress search query?

    Thanks in advance,

    TJ

Viewing 1 replies (of 1 total)
  • Thread Starter teejnits

    (@teejnits)

    Finally found out how… Was thinking too hard. Trying to be way to complicated.

    In my plugin I did the add_action(‘wp_head’, ‘my_function’) and thus the function is inserting something like this into the header:

    function my_function() {
    if(is_search()) {
    $search_key = get_search_query();

    /* Do what I want with the value */

    if( what I wanted worked ) {
    Stop the default search and do this;
    } else {
    Do nothing which will just let wp continue with searching
    }
    }
    }

    So what I was looking for was “get_search_query()” and I was searching for the wrong thing in Google and here…

Viewing 1 replies (of 1 total)
  • The topic ‘Intercept search term…’ is closed to new replies.