Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm attempting to add a Back to Search Results link which in essence will simply link back to the starting search page - for example /?s=test. I've taken a look at the global query vars and do see there is a paged query argument available -- which does do the job when the permalink structure is set to the default - for example /?s=test&paged=2 run through remove_query_arg(array('paged')) corectly becomes /?s=test. But, when you visit a second page of search results and you use anything but the default permalink structure - it is not removing page/2 which is what the default pagination structure outputs.

I believe I could just use $_GET['s'] and append that onto the site URL.. but I figured I'd ask here to see if there is a better way to do this. Thanks!

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

http://codex.wordpress.org/Function_Reference/get_search_link was what I was looking for.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.