Currently able to display the post author ID on the frontend with no difficulties. Returning the ID in /wp-admin when editing a post is proving to be tricky. Here's what I have so far:
$current_user_id = get_current_user_id(); // Get the current users ID
$author_id = get_post_field ('post_author', $post_id); // Get the author ID
if( is_user_logged_in() && $current_user_id == $author_id ) {
// wp-dashboard script
}
I've tried a handful of other methods for getting the user ID with no success. Displaying $current_user_id through the theme's functions.php file worked without issues along with other PHP code. Perhaps the ID isn't being loaded when functions.php loads?