2

I've tried displaying many post types (separated by comma) and it didn't work. Is there a way to achieve this?

$args = array( 'numberposts' => '5', 'post_type' => 'cpt1, cpt2, cptn');
    $recent_posts = wp_get_recent_posts( $args );

Thanks for your input.

5

Use post types as an array.

$args = array( 
    'numberposts' => '5', 
    'post_type'   => array('cpt1', 'cpt2', 'cptn') 
);
$recent_posts = wp_get_recent_posts( $args );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.