



























This short snippet restricts authors to only view the files from the media library which they have uploaded:
add_action('pre_get_posts','ml_restrict_media_library');function ml_restrict_media_library( $wp_query_obj ) {
global $current_user, $pagenow;
if( !is_a( $current_user, 'WP_User') )
return;
if( 'admin-ajax.php' != $pagenow || $_REQUEST['action'] != 'query-attachments' )
return;
if( !current_user_can('update_core') )
$wp_query_obj->set('author', $current_user->ID );
return;
}
Add this part to your functions.php or include it in a seperate plugin
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。