Forums › Forums › Search & Filter Pro › How to get queried url, modify URLs
Tagged: url
- This topic has 6 replies, 2 voices, and was last updated 7 years, 7 months ago by Trevor.
-
Anonymous(Private) May 3, 2017 at 11:14 am #106129
Hi guys, how can i get generated url from sf into a function?
I need to alter a parameter, i checked here: https://www.designsandcode.com/documentation/search-filter-pro/action-filter-reference/#Modify_URLs
but it doesn’t explain how to retrieve the sf url parameters.
If i try to print function i get “Missing argument 1 for query_url_results()”.
Is there a way to get queried url?Trevor(Private) May 3, 2017 at 11:58 am #106143That makes sense. The function you refer to is intended to be uses to alter the results url used to open a results page, which is not what you want.
You want to actually fetch the current page URL, like this:
global $wp; $current_url = home_url(add_query_arg(array(),$wp->request));
And then look at that and manipulate it in PHP (so echo it first, find the string that precedes the part you want, then split the current_url string up, alter the date, and stitch it back together again).
Trevor(Private) May 3, 2017 at 1:07 pm #106180I am not sure. I tried to
find a WordPress method to get the URL with query string
using google. Maybe read this:https://gist.github.com/leereamsnyder/fac3b9ccb6b99ab14f36
One suggestion was:
echo home_url( add_query_arg( null, null ));
This is a more generic WordPress question, so Google is your friend.
OR ….
You could use the Edit Query Arguments filter to get the date.
And in this case this thread might help:
https://support.searchandfilter.com/forums/topic/showing-the-search-query/
-
AuthorPosts