Skip to content

Instantly share code, notes, and snippets.

@alexknowshtml
Created March 24, 2014 20:01
Show Gist options
  • Save alexknowshtml/9747864 to your computer and use it in GitHub Desktop.
Save alexknowshtml/9747864 to your computer and use it in GitHub Desktop.
function barley_check_conditions() {
global $current_user, $post;
if ( isset($_GET['barley_editor']) && $_GET['barley_editor'] == 'off' )
return false;
if ( (is_single() || is_page()) && (is_main_query()) && (in_the_loop()) ) {
if ( current_user_can( 'edit_others_posts' ) || ($post->post_author == $current_user->ID) ) {
return true;
}
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment