How to hide post content/meta from everyone except the post author and admin
You can try below code – <?php global $current_user; if ((is_user_logged_in() && $current_user->ID == $post->post_author) || current_user_can( ‘manage_options’ )) { echo ‘my post’; } ?> Check below link also- https://codex.wordpress.org/Function_Reference/current_user_can