WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Simply put, I need to hide all posts on the frontend if they are written by authors with a specific role. The role I have created is called 'Suspended'.

I'm happy with putting a simple IF statement around the loop which prevents posts from a certain role ID from appearing. Preferably though it would be something I can enter into the WP_Query.

I Can't use user ID as there would be xx number of users with the same role.

Does anyone know how this could/ would be done? Any help would be very much appreciated. Thanks in advance.

share|improve this question
up vote 4 down vote accepted

Use WP_User_Query to build a list of suspended authors` ids, then use that list with minuses for inversion as author parameter in query.

share|improve this answer
Nice idea, I'll give it a try. – Adam Moss Jul 5 '11 at 14:45
@Adam Moss did this work? If so you could accept the answer – Tom J Nowell Nov 18 '11 at 13:46

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.