[wp-hackers] Selecting only publicly queryable posts

Gavin Pearce Gavin.Pearce at 3seven9.com
Fri Apr 8 11:30:01 UTC 2011


$args = array('publicly_queryable' => true); 	
$post_types = get_post_types($args);

Use _builtin = false if you don't want the WP builtin post types
(pages/posts/attachments).

http://codex.wordpress.org/Function_Reference/get_post_types

Gav


-----Original Message-----
From: wp-hackers-bounces at lists.automattic.com
[mailto:wp-hackers-bounces at lists.automattic.com] On Behalf Of Robert
Lusby
Sent: 08 April 2011 12:24
To: wp-hackers at lists.automattic.com
Subject: [wp-hackers] Selecting only publicly queryable posts

Can you select ONLY publicly_queryable posts from a database? (Thanks
everyone for your help on a related topic yesterday).

E.g, some custom post types are non publicly_queryable.

I need to select all posts in the database that are of a post_type that
are
publicly_queryable.

I can run that, if I can figure how you generate a list of the publicly
queryable post types? Any ideas?

Thanks as ever!

Rob
_______________________________________________
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