• 125 টি

I am a technology lover. Want to learn every part of it.With my little knowledge i will try to post some useful article in this site.Hope you will love that.If you love my posts, please say a thanks by sharing it.

1

Restrict Viewing photos that uploaded by others in wordpress

To restrict viewing the photoes that are uploaded by others , you have to put the codes in your function.php and save it :)
969497_157212721134155_1559974700_n

 function strawberry_author_media( $wp_query ) {
//are we looking at the Media Library or the Posts list?
if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false
|| strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
//user level 5 converts to Editor
if ( !current_user_can( 'level_5' ) ) {
//restrict the query to current user
global $current_user;
$wp_query->set( 'author', $current_user->id );
}
}
}
add_filter('parse_query', 'strawberry_author_media' );
Pin It
Filed in: WORDPRESS CODING Tags: , ,

Get Updates

Share This Post

Recent Posts

One Response to "Restrict Viewing photos that uploaded by others in wordpress"

Leave a Reply

Submit Comment

© 2014 iTECHNEWS24. All rights reserved.