Skip to content

Instantly share code, notes, and snippets.

View tsbega's full-sized avatar
🏠
Working from home

Tiago Bega tsbega

🏠
Working from home
View GitHub Profile
@tsbega
tsbega / functions.php
Created July 20, 2017 21:35 — forked from ofernandolopes/functions.php
Limit Authors to their Own Posts in WordPress Admin
function posts_for_current_author($query) {
global $pagenow;
if( 'edit.php' != $pagenow || !$query->is_admin )
return $query;
if( !current_user_can( 'manage_options' ) ) {
global $user_ID;
$query->set('author', $user_ID );
}
return $query;
}