• I’m doing some custom work integrating a wordpress blog into an existing site.

    I need to pass a custom query string value we’ve added through the search form.

    It appears that upon submit of the search form the url is rewritten.

    Can someone explain to a WordPress noob how I can retain the new parameter during this step?

    I’m assuming some modification to rewrite.php will be called for.

    Thanks in advance for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    How are you passing this parameter? GET and POST parameters are retained even through the rewrite. There’s nothing special that needs to be done. The only time you have to screw around with $wp_rewrite is when you want to convert something like “/tag/bob” into a parameter of “tag=bob” internally.

    For example, if you are passing your new parameter via GET, like https://example.com/?s=search_string&myparam=bob
    Then you can just look in $_GET[‘myparam’] to get back “bob”.

    Thread Starter arkham

    (@arkham)

    Thanks Otto. We were losing it despite the parameter being in the action of the search form. But duhh… adding the value as a hidden field in the form preserves it even on form post.

    My bad!

    Thanks very much for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘how to add and retain a custom query string value’ is closed to new replies.