Getting a post from its permalink?
-
If I have the string ‘bob’, how do I get the title of the post with the permalink mysite.com/bob?
Right now I’m trying:
$value = 'bob'; $thispost = get_post($value); echo '<li>' . $thispost->post_title . '</li>';However, that isn’t returning anything. Needless to say, $value is coming from somewhere else, but when I print $value directly, it’s the right text — so it’s the last step I’m unsure about.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Getting a post from its permalink?’ is closed to new replies.