Getting current URL

Forums › Forums › Search & Filter Pro › Getting current URL

Tagged: ,

  • This topic has 6 replies, 2 voices, and was last updated 10 years ago by Anonymous.
Viewing 7 posts – 1 through 7 (of 7 total)
  • Anonymous
    #66079

    Hello,

    I believe after updating to a new version I am getting only a part of current URL of the search results page.

    For example,
    http://bestweave.org/?sfid=14046&_sfm_width=5+6&_sfm_height=7+8&_sfm_sale_price=0+36873
    gets only http://bestweave.org/?sfid=14046 when I am trying to e-mail results page. It was working fine before.

    Here is a function that I use for getting current page URL:
    global $wp;
    $url = add_query_arg( $wp->query_string, ”, home_url( $wp->request ) );

    Any idea on what can cause this problem?

    Thanks for your time!

    Trevor
    #66220

    Our forum parsing software might have mangled that, as in the middle you have one double quote mark, but it should be two singles.

    However, that method is not reliable for all query strings.

    AFAIK the recommended WordPress method is this:

    $url = home_url( add_query_arg( NULL, NULL ) );
    

    Assuming you want the full relative path included.

    Anonymous
    #66362

    It still gets only first part of URL ending with a Search form ID.

    Trevor
    #66368
    This reply has been marked as private.
    Anonymous
    #66371

    Thank you!

    Trevor
    #66420

    Well, we are not sure why the code did work and now does not, nor do we know if S&F is the cause. Nor can we think of any other way to get the URL (the plugin does not do that). The only thin I could find was this:

    http://stackoverflow.com/questions/6768793/get-the-full-url-in-php/8891890#8891890

    Other than that, we are out of ideas, sorry.

    Anonymous
    #66422

    Ok, thanks for your help anyway.

Viewing 7 posts – 1 through 7 (of 7 total)
Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.