There’s no direct way of getting the post author’s email from a post. You can get the email by using the author ID, which is present in standard WP_Post object.
$post_author_id = intval( $post->post_author );
$post_author_email = get_the_author_meta('email', $post_author_id);
Or if you just have the post ID
$post_author_id = intval( get_post_field( 'post_author', $post_id ) );
$post_author_email = get_the_author_meta('email', $post_author_id);
Or if you want, you could also hook custom function to save_post
action and save the author email to the post’s meta, when the post is created. Then you could get the email with get_post_meta()
using post ID and the custom key you used to save the meta.
Related Posts:
- Use author author display name in permalink structure for pages and posts
- Import WordPress XML File from Within Functions.php
- Does hooking into the same action multiple times drain memory?
- How to influence the information displayed on widget inside wp-admin
- Extract image from content and set it as the featured image
- Is there a hook or function I can use to display all theme files being used on a current page?
- Show modified time if post is actually modified
- Add admin bar link to edit author
- How to create thumbnails for PDF uploads?
- Implementing DNS Prefetching with WordPress
- Help me to understand wp_header() and wp_footer() functions
- How can I add an extra WooCommerce hook
- Remove Page Title from Static Frontpage
- How to override WordPress registration and insert an auto-generated username?
- Set default options for inserting media
- Authors details such as social media links, emails etc → Is this Meta or something else?
- How to hook into the quick edit action?
- Display the number of user comments
- Is it possible to be more page/post specific with admin_enqueue_script?
- WooCommerce add_action hook results in 500 error
- Issue adding text after short description on product pages Woocommerce [closed]
- Customize “the_posts_pagination” and put list instead div
- Gravity Forms field entries into wp_query loop [closed]
- Post thumbnail relative link and HTML modify
- Hide Author.php template from specific user role
- Accepted arguments value in hook functions
- Get current page_id before loop, in functions.php
- Which action hook to use for function?
- Change size and crop medium_large images
- Gravity Forms – Using a Form to Pre-populate A Gravity Form [closed]
- How to automatically remove links from WordPress Biographical Info?
- Running a script before absolutely everything
- Inserting a functions output after the content
- How to display post content instead of excerpt
- Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘greenday_head’ not found or invalid function name
- Modify a function without editing template
- Don’t delete a page if it holds users
- Commenter should see only his comments in wordpress
- Problem only while using require_once() within functions.php
- Which action does wp_update_user triggers?
- Trigger a custom function when option are saved in admin area
- Add other social networks to TwentyNineteen_SVG_Icons class in child theme?
- wp-comment author- url +, email filter hook
- How to use wp_trash_post (or wp_delete_post) for deleting a (or all) post(s) from custom post type?
- What did I do wrong in my functions code, that will not change the “Get New Password” text to “Send It”?
- Footer disappears when using the_content ( )
- check if author has published posts in custom post type, then send mail
- Registration Hooks don’t appear to be working
- Why does re-using this function not work? [closed]
- Pass parameter to hooked function using custom page template
- Hook into a function without a hook?
- Is my code correct to enqueue CSS on a specific page?
- Author Date Function not working as expected [duplicate]
- Can’t properly set the_title add_filter to show short_URL
- Filter yoast canonical add_action priority [closed]
- (Woocommerce) Order by price when entering specific category
- How do I hook into the container of wp_nav_menu?
- Remove links from the_content when using filters wp_trim_excerpt
- Is there a way to prevent a function/method from being called outside a specific hook?
- Possible to hook into Media Library preview File column and use a custom image?
- Function not working inside of a function in functions.php
- Adding code before post title with the_title produces weird results
- This code works, but the way I integrated it is breaking the media uploader. How can I integrate it properly?
- Disabling Author Page only for subscribers
- Is it possible to use add_filter in an included file in the child theme’s functions.php?
- Insert Content Before div#main from the functions.php File
- update_post_meta is Updating with two page id
- Why I can’t load my JavaScripts using an hook inside my functions.php file?
- is_home() not working in functions.php file
- How to conditionally add a widget via a hook in functions.php
- Changing the text of Upload/Insert on Posts and Pages Screen
- How to add or delete default value theme options while activate and deactivate theme
- WordPress comment processing . Default unapproved comments detection before posting
- Warning at top of website & top menu gone
- Does hook have an effect on increasing the page load?
- Save_post – Warning: Cannot modify header information
- What is the earliest Hook a Script can use?
- How to use WP conditional tag in a functions.php with OCEANWP Theme?
- custom error message for empty username and password using authenticate filter not working
- Author social media aren’t shown on the page
- How To Display Author Popup on Entry Meta (Genesis Framework)?
- How can I stop the hook from breaking the login/logout function?
- True email confirmation for registration (keeping unvalidated users from user table)
- WordPress hooks to call a function inside a construct
- WordPress undefined function error on using add_action() in functions.php
- How to echo the translated custom field?
- Author info does not show up when author has no posts
- Function the_content
- save_post hook – headers already sent?
- Show the online status of the current post’s author
- Init hook for header send
- Add custom fields after post/page title
- Force resize for all video content
- Unhook the comment form in Buddypress
- How do I add functionality to images?
- How to hook wp_mail to add a custom email as BCC for each sent email?
- Assign new post author IF another user in custom field on post transition
- image_size with respect to aspect ratios
- delete_term is not working properly with add_action()
- How to add user_registered time in human_time_diff() wordpress