Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_filter('parse_query', 'own_content_only_restriction' );
- function own_content_only_restriction( $wp_query ) {
- if ( !current_user_can( 'see_others_media' ) ) {
- if ( strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/upload.php' ) !== false
- || strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/admin-ajax.php' ) !== false
- || strpos( $_SERVER[ 'REQUEST_URI' ], '/wp-admin/edit.php' ) !== false ) {
- global $current_user;
- $wp_query->set( 'author', $current_user->ID );
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement