Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save subharanjanm/67dc5192d9763f7c805e to your computer and use it in GitHub Desktop.
Save subharanjanm/67dc5192d9763f7c805e to your computer and use it in GitHub Desktop.
add_filter( 'tw_query_args', array( &$this, 'query_args' ), 10, 2 );
public function query_args( $args, $atts ) {
global $wpdb;
$args['post_type'] = $atts['post_type'];
$no_cache = $atts['no_cache'];
if ( $no_cache ) {
$args['no_cache'] = 1;
}
if ( empty( $args['post__in'] ) ) {
$post__in = array();
} else {
$post__in = $args['post__in'];
}
if ( ! empty( $post__in ) ) {
$post__in = array_unique( $post__in );
$args['post__in'] = $post__in;
}
return $args;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment