Skip to main content
added clarity with an example based on OP's code.
Source Link
Iceable
  • 865
  • 6
  • 14

You can pass multiple custom post types in an array for 'post_type', as in:

'post_type' => array('books', 'movies''stories', 'tvshows''movies')

Your code seems to try to do this, but the syntax is a bit off., it should be:

$recent_posts = wp_get_recent_posts(
    array(
        'post_type' => array( 'books', 'stories', 'movies' ),
    )
);

You can find more details about every available args in the Documentation for WP_Query.

You can pass multiple custom post types in an array for 'post_type', as in:

'post_type' => array('books', 'movies', 'tvshows')

Your code seems to try to do this, but the syntax is a bit off.

You can find more details about every available args in the Documentation for WP_Query.

You can pass multiple custom post types in an array for 'post_type', as in:

'post_type' => array('books', 'stories', 'movies')

Your code seems to try to do this, but the syntax is a bit off, it should be:

$recent_posts = wp_get_recent_posts(
    array(
        'post_type' => array( 'books', 'stories', 'movies' ),
    )
);

You can find more details about every available args in the Documentation for WP_Query.

Source Link
Iceable
  • 865
  • 6
  • 14

You can pass multiple custom post types in an array for 'post_type', as in:

'post_type' => array('books', 'movies', 'tvshows')

Your code seems to try to do this, but the syntax is a bit off.

You can find more details about every available args in the Documentation for WP_Query.