WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Get current page url

[Resolved] Get current page url

  • is there a templete tag or something within WP to get the exact url of the current page (including the ?p=2 stuff)?

    thanks in advance.

Viewing 3 replies - 1 through 3 (of 3 total)
  • gregorsmith
    Member

    @gregorsmith

    <?php the_permalink() ?>

    ?

    This isn’t a template function, but you can use it to get the requested URI, you’ll just need to add your domain to it:

    <?php
    $Path=$_SERVER['REQUEST_URI'];
    $URI='http://www.example.com'.$Path;
    ?>

    That will output the full URI, including the query string. You can then echo the $URI variable or use it for whatever else.

    Good luck,
    Michael.

    thanks, that really helped.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Get current page url’ is closed to new replies.