WordPress.org

Support

Support » Plugins and Hacks » Hacks » Search Permalink: replace string "?s=" to permalink structure

Search Permalink: replace string "?s=" to permalink structure

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    @bcworkz

    Yes! You will mainly be using add_rewrite_rule(). This basically accepts a permalink like you envision and rewrites it back the way it is normally behind the scenes so the request parser knows that it’s a search request.

    You’ll also need to use the ‘request’ filter to convert the hyphens back to pluses.

    Hi bcworkz.. Thanks a lot for your reply.

    Do you already have the code (php and htaccess) that I need?

    Thanks a lot again for your time.

    Moderator bcworkz

    @bcworkz

    Sorry, no. Truth be told, I haven’t fully figured out rewrites. Sometimes they work fine, other times not. I haven’t figured out an efficient debug method to determine why things don’t work either. I can suggest you ensure your regexp is working independent of rewrites before attempting to use it in rewrites.

    Also that when using the WP Rewrite API, you don’t need to be concerned about .htaccess, WP will revise its entry if it needs to. It’s also possible to use a solely .htacces solution independent of the WP Rewrite API. Hopefully yours is one of those implementations that work fine right away. Good luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Search Permalink: replace string "?s=" to permalink structure’ is closed to new replies.
Skip to toolbar