Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /** Give User Role Editor to Access All Media */
- function give_user_role_editor_to_access_all_media() {
- /* Check if user is editor role or not */
- if ( in_array( 'editor', (array) wp_get_current_user()->roles ) && ! current_user_can( 'manage_options' ) ) {
- /* For Show ALl Media in Grid View */
- add_filter( 'ajax_query_attachments_args', 'show_all_media_for_editor_child', 99 );
- /** Grid View */
- function show_all_media_for_editor_child( $query ) {
- $query['author'] = '';
- return $query;
- }
- /* For Show ALl Media in List View */
- remove_action( 'pre_get_posts', array( JNews\AccountPage::getInstance(), 'users_own_attachments' ) );
- }
- }
- add_action( 'init', 'give_user_role_editor_to_access_all_media' );
Add Comment
Please, Sign In to add comment