[wp-hackers] WP_Query and multiple pages

Ade Walker photofantaisie at gmail.com
Mon Aug 3 19:20:00 UTC 2009


Hi all,

If this has been down to death before - apologies in advance. I've googled
for hours and haven't come up with anything definitive on this.

It seems that trying to query several page_id's when using
query_posts/WP_Query doesn't work.

query_posts('page_id=1,2,3,4') doesn't work, and neither does:

query_posts('post__in' => array(5,12,2,14,7)) where the ID's are actually
page_id's.

Is there any way to query a selection of specified Pages? In usual
situations (to display page content) I can see that there isn't much logic
in being able to do this, but I want to access Custom field keys/values for
a selection of Pages for a plugin.

Other than an SQL query (which I'm using temporarily), any ideas gratefully
received! :-)

Thanks.

Ade.


More information about the wp-hackers mailing list