I need code to get post url without a href, for example: <a href="http://mywebsite.com/permalink" rel="permalink">single post title</a>

i just need the url like: http://mywebsite.com/permalink/ on single.php

1 Answer 1


What 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.