Hi guys.
I need to know what is the function that returns the current URL. I used get_permalink() but this don't work with the main page, the categories page, search... and other pages, only works for the posts pages.
Thanks.
Hi guys.
I need to know what is the function that returns the current URL. I used get_permalink() but this don't work with the main page, the categories page, search... and other pages, only works for the posts pages.
Thanks.
<?php echo $_SERVER['PHP_SELF'] ?>
If you want something else, then google "php get current url" to find the code snippet you need.
Thanks, the correct code is:
<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"] ?>
You can use get_permalink() outside the loop with an ID as a parameter:
<?php echo get_permalink( $post->ID ); ?>
You must log in to post.