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.

I would like to hide all media uploaded by the admin.

I've found an answer to this question to be pretty close. Except that the query returns all media uploaded by a specific (current) user, instead of excluding all by a specific user.

[...]
if( !current_user_can('delete_pages') )
    $wp_query_obj->set('author', $current_user->id );
[...]

Q: Is it possible to modify the wp_query_obj to exclude all posts by a specific user?

share|improve this question

1 Answer 1

up vote 1 down vote accepted

The method is similar, just exclude the author by prefixing the id with a minus sign:

$wp_query_obj->set( 'author', '-1' );

See WP_Query for a full list of query arguments.

share|improve this answer

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.