您可以使用以下代码限制用户只能看到自己上传的媒体:
<?php
/*
Plugin Name: Manage Your Media Only
Version: 0.1
*/
//Manage Your Media Only
function mymo_parse_query_useronly( $wp_query ) {
if ( strpos( $_SERVER[ \'REQUEST_URI\' ], \'/wp-admin/upload.php\' ) !== false ) {
if ( !current_user_can( \'level_5\' ) ) {
global $current_user;
$wp_query->set( \'author\', $current_user->id );
}
}
}
add_filter(\'parse_query\', \'mymo_parse_query_useronly\' );
?>