Viewing 4 replies - 1 through 4 (of 4 total)
  • One way I can think of would be to have a custom GET parameter (e.g. example.com/?s=query+terms&my-plugin-parameter=groups), have your plugin detect this GET parameter, and use that data to formulate a WP Query request.

    Thread Starter PauloASilva

    (@pauloasilva)

    Hi Odai,
    By now I am using that approach, but I would like to use something “cleaner”.

    I don’t know why but with some WP setups I can perform searches at https://mysite.cmo/search/search-keywords.

    There’s a ‘search_base’ WP_Rewrite option and other three pre-defined search rewrite rules. I would expect to be able to modify them somehow to accomplish my goal, but I was not able on my trials.

    Thanks for your reply,
    Paulo A. Silva

    I see. That is challenging. In my limited experience WordPress’s permalink behavior, it can be hard to manage.

    Could you use the PHP $_SERVER['REQUEST_URI'] variable to get the request URL, parse it in your function, and use that to formulate the search request? Kind of duplicates what WP already does, but you’d have more control (you’d want to check if $wp_rewrite is enabled first, of course).

    I also downloaded the plugin Nice Search and read through the code (also see Custom Search URL, which is an extension of the former). Maybe worth looking at.

    Thread Starter PauloASilva

    (@pauloasilva)

    Hi Odai,
    I had a look at Nice Search and what I really didn’t like was the wp_redirect() call.

    I wouldn’t like to add an extra redirect to my “load time”.
    Hopefully I will be able to accomplish my goal just hooking WordPress bootstrap, because all URIs are “sent”/redirec to index.php.

    Thanks for your reply,
    Paulo A. Silva

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘custom permalinks/URIs’ is closed to new replies.