Skip to content

Instantly share code, notes, and snippets.

@mikakaltoft
Created December 3, 2015 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mikakaltoft/92a3d4d1069c691111ce to your computer and use it in GitHub Desktop.
Save mikakaltoft/92a3d4d1069c691111ce to your computer and use it in GitHub Desktop.
/* Limits the author user role to create contact forms and ONLY see own contact forms */
add_filter('parse_query', 'rocapress_extend_author_user_role' );
function rocapress_extend_author_user_role( $wp_query ) {
if( is_admin() ) {
if ( admin_url() . 'edit.php' !== false ) {
if ( current_user_can( 'author' ) ) {
global $current_user;
$wp_query->set( 'author', $current_user->ID );
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment