WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Get current page url (4 posts)

  1. lobsterman
    Member
    Posted 8 years ago #

    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.

  2. gregorsmith
    Member
    Posted 8 years ago #

    <?php the_permalink() ?>

    ?

  3. niziol
    Member
    Posted 8 years ago #

    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.

  4. lobsterman
    Member
    Posted 8 years ago #

    thanks, that really helped.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.