Peter @ WordPress – Get ID by post or page name


Thanks, this is just what I was looking for – I need to pull a post id from a post slug for something different, and this did the trick.

It’s worth noting that post_name actually holds the slug (generally the post name with dashes inserted for non-alphanumeric characters), and post_title actually holds the title of the post.