[wp-hackers] get_post_by_slug ( $slug, $post_type )

John Blackbourn johnbillion+wp at gmail.com
Sun Dec 12 18:25:10 UTC 2010


There's get_page_by_path() but I'm honestly not sure if it works with
non-hierarchical post types. Give it a try. Beware though that this
function isn't very well optimised and it'll perform an SQL query with
each call, so if you use it lots then keep an eye on your total SQL
queries.

John

On Sun, Dec 12, 2010 at 6:19 PM, Scott Kingsley Clark <scott at skcdev.com> wrote:
> Anyone believe a function like this may find it's way into WP, or is
> anyone familiar with an existing function that accomplishes the same
> thing? If not, I'll put together a trac ticket with an example of how
> this function would work and get the discussion going.
>
> -Scott
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list