If you’re using WP_Query
to do your loop it should be as simple as getting all the post IDs and then setting them as negative in the p
parameter.
For example:
$unwanted_posts = array(); // you must generate this
$unwanted_posts_str="-".implode( ',-', $unwanted_posts );
$args = array(
'p' => $unwanted_posts_str
);
You can also set this on an existing query using the set()
method.