Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.