当我提供给定的网址时,我想知道如何从wordpress帖子中获取帖子ID。
例如,我想从网址http://stormable.com/heroes/illidan/获取帖子ID 我不是在寻找我所关注的帖子的网址,而是我正在提供的网址。
$postid = post id from the url http://stormable.com/heroes/illidan/
我不确定这是否可行,但这正是我正在寻找的,所以我可以使用帖子ID。
答案 0 :(得分:0)
查看url_to_post_id:url_to_postid http://codex.wordpress.org/Function_Reference/url_to_postid
答案 1 :(得分:0)
<?php $postid = url_to_postid( $url ); ?>
此功能需要启用重写规则。 虽然你提供的链接已经重写了。