Discussion:
get_post_by_slug ( $slug, $post_type )
Scott Kingsley Clark
2010-12-12 18:19:57 UTC
Permalink
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
John Blackbourn
2010-12-12 18:25:10 UTC
Permalink
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
Post by Scott Kingsley Clark
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
http://lists.automattic.com/mailman/listinfo/wp-hackers
Scott Kingsley Clark
2010-12-12 18:31:59 UTC
Permalink
You know what, get_page_by_path ( $path, $output, $post_type ) does
it, didn't notice it had changed ;)

Thx anyways.

-Scott

Continue reading on narkive:
Loading...