I need code to get post url without a href, for example: <a href="; rel="permalink">single post title</a>
i just need the url like: /
on single.php
I need code to get post url without a href, for example: <a href="http://mywebsite/permalink" rel="permalink">single post title</a>
i just need the url like: http://mywebsite/permalink/
on single.php
1 Answer
Reset to default 2What you need is get_permalink
, e.g.
$current_post_url = get_permalink();
You can either use it inside a post loop, or pass it a post ID as a parameter.