1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | //メディア自分ののみ add_action( "pre_get_posts" , "set_ajax_media_query" ); function set_ajax_media_query( $wp_query ) { global $current_user ; if ( $wp_query ->query_vars[ 'post_type' ] != "attachment" ) { return ; } get_currentuserinfo(); if ( $current_user ->roles[0] == "administrator" ) { return ; } $wp_query ->query_vars[ 'author' ] = $current_user ->ID; } |