• Resolved lobsterman

    (@lobsterman)


    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

    (@gregorsmith)

    <?php the_permalink() ?>

    ?

    niziol

    (@niziol)

    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='https://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.

    Thread Starter lobsterman

    (@lobsterman)

    thanks, that really helped.

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