Created
January 9, 2018 14:40
-
-
Save trueqap/9d2f06eac165414550bb37cc365761c4 to your computer and use it in GitHub Desktop.
This file contains 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 | |
function posts_for_current_author($query) { | |
global $pagenow; | |
if( 'edit.php' != $pagenow || !$query->is_admin ) | |
return $query; | |
if( !current_user_can( 'edit_others_posts' ) ) { | |
global $user_ID; | |
$query->set('author', $user_ID ); | |
} | |
return $query; | |
} | |
add_filter('pre_get_posts', 'posts_for_current_author'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment