I have created a function that only allow the user "author" to see his/her own posts. The post view is based on the users ID. However, is there any bright person that knows how I can make the restriction role based - so that all authors only can see their post, so editors only can see their posts and so on.
Here is my code: https://gist.github.com/mikakaltoft/92a3d4d1069c691111ce
I tried with $wp_query->set( 'role', 'editor' ); however, that doesn't seems to do the trick.