Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
WordPress: Related posts with WP_Query.
$related_query = new WP_Query(array(
'post_type' => 'post',
'category__in' => wp_get_post_categories(get_the_ID()),
'post__not_in' => array(get_the_ID()),
'posts_per_page' => 3,
'orderby' => 'date',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.