WP API post__not_in is not working
I'm using WP API to get posts in my application and I'm trying to exclude some posts from query using filter[post__not_in]
.
after removing filter
in WP 4.7, I'm using WP REST API filter parameter
plugin to get it back. and it works for all parameters but for post__not_in
it's not effecting at all, I still get all posts.
I saw some closed issues about this on WP API repo on github, they said that post__not_in
are not allowed for unauthenticated requests, I also found merged PR claimed that they fixed it, but I tried to use this function
add_filter( 'query_vars', function( $vars ){
$vars[] = 'post__in';
$vars[] = 'post__not_in';
return $vars;
});
but now whatever I pass to post__not_in
I get empty response
any ideas how to exclude post in WP API?