Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Illustrate how to check the value of ```post__in``` before it is used to construct a new ```WP_Query``` object.

View example.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
<?php
$my_posts = false;
$my_post_ids = mytheme_get_special_post_ids();
if ( ! empty( $my_post_ids ) ) {
$my_posts = new WP_Query( array(
'post__in' => $my_post_ids,
'post_status' => 'publish',
'posts_per_page' => 10,
'no_found_rows' => true,
) );
}
if ( $my_posts ) {
// Do something with the posts here.
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.