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 );
$wp_query_obj->set('post__in',kk_ids());
return;
}
function kk_ids(){
// $posts =query_posts(array('post_type'=>'kklibrary','posts_per_page'=>-1));
// foreach ($posts as $post):
// $post_thumbnail_id[] = get_post_thumbnail_id( $post->ID);
// endforeach;
// wp_reset_query();
return $post_thumbnail_id= array(248,249,250,251,252,253,254);
}
add_action('pre_get_posts','ml_restrict_media_library');
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 );
$wp_query_obj->set('post__in',kk_ids());
return;
}
function kk_ids(){
// $posts =query_posts(array('post_type'=>'kklibrary','posts_per_page'=>-1));
// foreach ($posts as $post):
// $post_thumbnail_id[] = get_post_thumbnail_id( $post->ID);
// endforeach;
// wp_reset_query();
return $post_thumbnail_id= array(248,249,250,251,252,253,254);
}
add_action('pre_get_posts','ml_restrict_media_library');