The easiest way would be using get_post_field()
:
$post_author_id = get_post_field( 'post_author', $post_id );
For more details on this issue: have a look at this StackOverflow answer.
Related Posts:
- Custom Walker: how to get ID in function start_lvl
- how to flush custom author rewrite rule
- How can I get the page url slug when ‘post_name’ returns an id?
- Paginate Author’s Post List on Custom Author Page (ANOTHER THEORY)
- How to encode author ID in the author permalink
- How to display page ids as page slug names?
- Inline-Table under TwentyTwelve not working
- Different profile page by role
- How to get Previous Visited Page Information
- How to add custom Author Info Box to blog posts “only” and NOT custom post templates
- Redirect Every Instance of The Author Template Pages to Custom Author Pages
- Changing starting number of User ID
- User registration add user ID?
- Should I delete the default themes?
- Moving WP install from local to live, what about wp_posts GUID?
- Rename UPLOADS folder with custom WP_CONTENT_DIR
- Upgrading WordPress and Plugins; any Tips to Avoid Trouble?
- Modify column_author in WP_Comments_List_Table
- What are the ways to use WordPress as a user generated content site
- Win7 Dev Environment
- Converting primary keys from autoincrement integers to UUIDs
- Adding Custom Link anchors in the top menu that points to specific sections of the site home page
- TinyMCE default link target to “_blank”
- setting a specific home page for logged in users
- Page with several user editable text content
- Fast way to add countries as a custom taxonomy term?
- trying to modify colormag-fr_FR.po
- Programmatically add a custom page/path/url/route to WordPress
- Get multiple db prefix with $wpdb
- How do I remove the eye icon that shows visibility on login screen and reset password screen
- Passing page url into a custom field via the Press-This bookmarklet
- Using transients to store captchas
- How to extend nav-menu-item-control data in Appearance > Customize?
- Video to stretch across the entire homepage [closed]
- How can I allow access to multiple users, using the same login, at the same time?
- Does all editing of WordPress occur within the dashboard, or can we use our own text editor?
- Is it possible to have one page with multiple items, or 2 blogs on a site?
- Function to allow “Anyone can register”?
- Fatal error in wp-admin/customize.php after fresh install due to null $wp_customize
- TwentyFifteen: How can it show a different color on every post page?
- Show posts by a custom post author
- wp_query get post custom taxonomy in search.php
- Custom login with external provider iframe and data object
- Users can only view their content from the front end
- Localization: I want the backend: english and frontend in defined language
- Theme compression/ minifying or W3 Total Cache – which should I use? [closed]
- How to remove all the items under “Personal Options” on user profile page?
- Extend WordPress Core Classes in OOP Theme?
- How To Load an HTML File As A WordPress Page (With No 301/No Redirect)
- how to display a specific wordpress menu?
- User bar above logotipo?
- Create a url structure for my blogs based on categories and sub-cats
- Can I integrate wordpress with my current website so I can utilize the wordpress plugins?
- Sticky menu for WP custom menubars
- More tag – how do I remove preceding ?
- Salesforce lead tracking with contact forms plugins [closed]
- Stop Expansion of Top Level Menu in the WordPress Admin Sidebar
- How can style text like this in wordpress
- Add or Create Custom Structure Tags to Permalink
- Setup database structure with books, authors, languages etc. for publishing house [closed]
- Dynamically Filtering Posts by Data Points – Any Pointers?
- Woocommerce custom checkout form
- Remove year from title
- How to remove admin menu pages inserted by plugins and themes in the top admin bar?
- WordPress custom dropdown listings
- Custom Tags Archive – permalinks not working
- Help customising admin bar, removing buddypress links from dropdown
- Do I need to instantiate the XMLRPC class or any class in another class to access its methods?
- WordPress in a Subdirectory
- Change Site Logo or Menu Logo Per Page
- javascript file not working in a plugin template file
- If Term Name Exists, Append a Unique ID to Slug
- How can I display both LTR and RTL language texts on the same page?
- New Page/Post Screen Opens an Existing Post
- how can custom permalink structure use for specify custom post type
- Add button to My Sites dashboard page (multisite)?
- Cannot go to next page on phone but can on computer
- A specific menu inside a page, load different contents without reloading it, under the same link
- How to hide or remove a custom widget area when empty
- Dockerized WordPress is having Nginx Proxy Issues
- Create single{custom}.php with data in table out of wp_posts
- Highlight specific user with custom field value
- How to define a static Home page
- let users add multiple divs in static page
- Best way to replace image url with source
- Multiple Taxonomies Using Custom SQL Query
- Logged in only custom page
- Make Terms Under Custom Taxonomy Use Specific Single.php Template
- Problem Locating and Changing Alt Attribute Of Link
- Pull certain WordPress posts on custom CMS instead and 301 wordpress to it?
- Show Site Name on WP login screen
- Adding css and js to a blank page created with custom template
- Create users via PHP
- Show post content in two different places without redirect
- Applying my own css classes in wp_menus 3?
- Changes to code not displaying
- Permalink Listing WordPress
- Has the table name in SQL for WordPress changed from WP_posts to WPCS_post?
- Multi color post title by using custom javascript inside the gutenberg editor?
- Add custom styles to the Raft theme