Created
January 26, 2023 06:31
-
-
Save rubelmiah/3ef4f51110591aee1b63e64e35cde9c8 to your computer and use it in GitHub Desktop.
Beside administrator show only image media files.
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
<?php | |
/** | |
* Beside administrator show only image media files. | |
* | |
* @param [type] $query | |
* @return void | |
*/ | |
function show_only_image_media_files( $query ) { | |
if ( ! current_user_can('administrator') ) { | |
$query['post_mime_type'] = 'image'; | |
} | |
return $query; | |
} | |
add_filter( 'ajax_query_attachments_args', 'show_only_image_media_files' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment