we can use
$user = wp_get_current_user();
if ( !in_array( 'administrator', (array) $user->roles ) )
to get the user role of the viewer. but i want to ignore who views. i want to get who writes the post. need something like
$user = wp_get_post_author();
if ( !in_array( 'administrator', (array) $user->roles ) )
so that i can show results depending on the user who writes the post while ignoring who views that.
get_the_author()
)?