Skip to content

Instantly share code, notes, and snippets.

Olivier Cardoen oliviercardoen

  • Octopix
  • Belgique
Block or report user

Report or block oliviercardoen

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@oliviercardoen
oliviercardoen / Wordpress Privilege Author Media
Last active Aug 29, 2015 — forked from bencooling/Wordpress Privilege Author Media
Prevent Authors from seeing other authors media files
View Wordpress Privilege Author Media
// Prevent Authors from seeing other authors media files
add_filter('parse_query', 'my_parse_query' );
function my_parse_query( $wp_query ) {
// Only applicable for Media Library && Media Upload Dialog
if (! preg_match('/wp-admin\/(?:upload|media-upload|admin-ajax).php/', $_SERVER['REQUEST_URI']) ) {
return;
}
global $current_user;
$user_roles = $current_user->roles;
$user_role = array_shift($user_roles);
You can’t perform that action at this time.