/** * Gets author ID by post ID. * * Alternative solution: `get_post( $post_id )->post_author` * * @see https://wpcodebook.com/wordpress-get-author-id-by-post-id/ */ function wpcodebook_get_post_author( $post_id ) { return get_post_field( 'post_author', $post_id ); }