最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - How to get post permalink url without a href

programmeradmin0浏览0评论

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

Share Improve this question asked Aug 16, 2020 at 21:02 Vincenzo PiromalliVincenzo Piromalli 1989 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 2

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.

发布评论

评论列表(0)

  1. 暂无评论