Robin Knight Robin Knight - 1 year ago 165
PHP Question

Wordpress get multiple posts by id

I need to get multiple posts in wordpress by ID.


I assumed that that might work, but it only gives the first post.

I tried then to use an array:

$args = array( 'p' => array(34,36));

That delivered no results.

NO and
Last one only

Any ideas?

Answer Source
$args = array( 'post__in' => array(34,36) );

Be sure to check out as well, the section Interacting with WP_Query will be very valuable to you.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download