Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function posts_for_current_author($query) {
- global $pagenow;
- $tempuser = wp_get_current_user();
- if( 'edit.php' != $pagenow || !$query->is_admin )
- return $query;
- if( in_array( 'client-event', (array) $tempuser->roles ) ) {
- add_action( 'views_edit-post', 'child_remove_some_post_views' );
- global $user_ID;
- $query->set('author', $user_ID );
- }
- return $query;
- }
- function child_remove_some_post_views( $views ) {
- unset($views['all']);
- unset($views['publish']);
- unset($views['trash']);
- unset($views['draft']);
- unset($views['pending']);
- return $views;
- }
- add_filter('pre_get_posts', 'posts_for_current_author');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement