Created
September 30, 2016 05:47
-
-
Save developer-anuragsingh/e6d727edfc3c2251740ba982d5b7b711 to your computer and use it in GitHub Desktop.
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
// Ref - https://codex.wordpress.org/Plugin_API/Filter_Reference/ajax_query_attachments_args | |
add_filter( 'ajax_query_attachments_args', 'show_current_user_attachments', 10, 1 ); | |
function show_current_user_attachments( $query = array() ) { | |
$user_id = get_current_user_id(); | |
if( $user_id ) { | |
$query['author'] = $user_id; | |
} | |
return $query; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment