-1

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?

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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