How to Get WordPress Author ID by Post ID

You can get wordpress author id by post id like that. Using the get_post_field() function, we can extract the post_author field with the $post_id variable. Other fields we can extract post_content, post_author, post_title, post_name (slug), post_excerptpost_statuscomment_statuspost_parentpost_typecomment_count, post_date, ping_status, post_modified and etc.


$author_id = get_post_field( 'post_author', $post_id );


  • Mucha

    My brother suggested I might like this website. He was entirely right. This post actually made my day. You can not imagine simply how much time I had spent for this info! Thanks!


Leave a Reply

Your email address will not be published. Required fields are marked *