Skip to content

Instantly share code, notes, and snippets.

@hokuma
Created August 24, 2013 04:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hokuma/6326109 to your computer and use it in GitHub Desktop.
Save hokuma/6326109 to your computer and use it in GitHub Desktop.
メディア選択時に自分の投稿写真だけ表示する ref: http://qiita.com/halhide/items/35cb62ba3107ac19f4db
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;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment