Timeline for How to get custom post type post id from slug?
Current License: CC BY-SA 3.0
4 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 19, 2022 at 21:40 | comment | added | gregdev | Good solution for when you're not sure of the post type. | |
Mar 2, 2018 at 23:03 | comment | added | Philipp |
The url_to_postid is a very flexible function: you can pass in any kind of permalink/full URL and get the most accurate post-ID for that URL. However, because of the flexible usage it's quite slow (esp. with lot of endpoints/post-types). If you only pass in a slug for a specific post type, it's a lot faster to use get_page_by_path()
|
|
Nov 3, 2017 at 22:36 | review | First posts | |||
Nov 3, 2017 at 22:53 | |||||
Nov 3, 2017 at 22:31 | history | answered | Syclone | CC BY-SA 3.0 |