WordPress.org

Ready to get started?Download WordPress

Forums

Get REALLY current page URL (1 post)

  1. dejudicibus
    Member
    Posted 1 year ago #

    I am trying to get the current page url, whatever be the page, but I cannot find a way WHEN REWRITE is involved by some plug-in, as for instance qTranslate.

    In fact, if you use get_permalink() you obtain the URL of the last post in loop if taken outside of loop, so it is ok if you are on a post page, not in other cases.

    On the other hand, if you use

    <?php
    function curPageURL() {
     $pageURL = 'http';
     if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
     $pageURL .= "://";
     if ($_SERVER["SERVER_PORT"] != "80") {
      $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
     } else {
      $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
     }
     return $pageURL;
    }
    ?>

    you get the URL *without* the changes applied by plug-in. I need to get exactly what is in the browser URL field. Any help appreciated.

Topic Closed

This topic has been closed to new replies.

About this Topic