Title: get_post_by_path?
Last modified: August 19, 2016

---

# get_post_by_path?

 *  [wuchschba2](https://wordpress.org/support/users/wuchschba2/)
 * (@wuchschba2)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get_post_by_path/)
 * Hello! I’m new to WordPress but got a lot of experience in programming of php.
   I’m wirting a plugin right now, which developed easy and straight forward so 
   far.
 * But now I came over an odd thing: I needed to get a category from an URL, so 
   I used get_category_by_path. Fine
 * But what do you do if you got a URL from a post and you need the post-id? I’m
   missing a method get_post_by_path.
 * The only way I found out I could find a post by an URL is to query the database–
   but why should there be a method for the categories but not for posts? Can you
   help me please? Thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get_post_by_path/#post-1131160)
 * There is the [template tag](http://codex.wordpress.org/Template_Tags), [query_posts()](http://codex.wordpress.org/Template_Tags/query_posts):
 * `query_posts('name=about-my-life');`
 *  Thread Starter [wuchschba2](https://wordpress.org/support/users/wuchschba2/)
 * (@wuchschba2)
 * [16 years, 11 months ago](https://wordpress.org/support/topic/get_post_by_path/#post-1131386)
 * Ah, thanks a lot!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘get_post_by_path?’ is closed to new replies.

## Tags

 * [path](https://wordpress.org/support/topic-tag/path/)
 * [post](https://wordpress.org/support/topic-tag/post/)

 * 2 replies
 * 2 participants
 * Last reply from: [wuchschba2](https://wordpress.org/support/users/wuchschba2/)
 * Last activity: [16 years, 11 months ago](https://wordpress.org/support/topic/get_post_by_path/#post-1131386)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
