WordPress – remove some posts from query

I’m trying to make a plugin.
Its job is to generate and send a link to the author after a post is published by admin.
After clicking on the link will be the post actually published.
I did that after the click on the link there will be a post meta added to the post.

NOW I cant find a solution how to show only posts with the meta or ADMINS (or with some user level) posts.

Read More

I decided I need a filter bud I cant figure out how to do the ADMIN posts exceptions.

How do I filter only non-admin posts.

I think I need to remove the “bad” posts from $query but how ?

add_filter( 'pre_get_posts' , 'postsClean' );

function postsClean( $query ){
// check all posts and if the post should be not published remove it from query
}

Or is there any better way ?

Related posts

Leave a Reply

1 comment