Skip to content

Instantly share code, notes, and snippets.

@ajaydsouza
Created March 28, 2016 16:25
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajaydsouza/75923b42aa0f0cdcb197 to your computer and use it in GitHub Desktop.
Save ajaydsouza/75923b42aa0f0cdcb197 to your computer and use it in GitHub Desktop.
CRP - Limit to same post type
<?php
/**
* Filter the post types to limit it to the same post type.
*
* @param array $post_types Array of post types included in WHERE clause
* @return array Updated array of post types
*/
function crp_same_post_type( $post_types ) {
global $post;
$post_types = array(
$post->post_type => $post->post_type
);
return $post_types;
}
add_filter( 'crp_posts_post_types', 'crp_same_post_type' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment