Created
August 24, 2013 04:43
-
-
Save hokuma/6326109 to your computer and use it in GitHub Desktop.
メディア選択時に自分の投稿写真だけ表示する ref: http://qiita.com/halhide/items/35cb62ba3107ac19f4db
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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