Try this workaround of this issue without using publish_post
hook (using save_post
)
add_action( 'save_post', 'wpse228941_save_post' );
function wpse228941_save_post( $post_id ) {
if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
if ( "publish" == get_post_status( $post_id ) && ! get_post_meta( $post_id, "se_228941_mailed", 1 ) ) {
do_action( "sm12_publish_post", $post_id );
update_post_meta( $post_id, "se_228941_mailed", time() );
}
}
add_action( 'sm12_publish_post', 'sm12_publish_post' );
function sm12_publish_post( $postid ){
$email = get_post_meta( $postid, '_some_email_address', true );
if( ! $email )
return;
$sub = 'test subject';
$mgs="test message";
wp_mail( $email, $sub, $mgs );
}
Hope it helps.
Related Posts:
- Visual Studio SignTool.exe Not Found
- How can I set a draft page as parent without publishing?
- Display a post’s publish date from 2112
- Does blocking xmlrpc.php affect pinging update services like pingomatic
- I can’t preview post’s change once they are published
- Publish post when edit post form submitted with enter/return pressed on keyboard
- How to make scheduled post preview visible to anyone?
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- Why does publish_{custom-post-type} fire on update?
- Show recent published posts
- Is there a way to know if a post has been published through XML-RPC?
- How to unpublish a page and still keep a draft?
- get_terms on save_post hook
- Save and Publish button not working after installing SSL
- Disable “preview changes” button
- Can we have private drafts?
- Update post meta on bulk edit / update
- Can’t schedule post for another time
- Custom save button shows ‘Are you sure you want to…’ dialog
- Get publish post link?
- Controlled publishing in WordPress
- Change the text of the publish button to Save
- problem with publish date not always appearing [duplicate]
- What is happening to make my Update/Publish button disabled?
- What is the reason for the new_to_publish hook not working?
- After I publish a post where does it go
- Should you manually ping new WordPress posts?
- Authors should not publish
- How to add custom status to quick edit
- I need to modify drafts using custom data from database and then publish it
- How to show or hide a post based on meta_value selection?
- i am making text changes on my page show in preview not on live site, why? [closed]
- Is WordPress “publish” atomic?
- How to move post process to background
- How does redirect work when publish date changes and date in url changes?
- Gutenberg publish date datepicker
- How Google Indexer should only index published pages
- Publish and go to page [duplicate]
- Publish Post Action Not Working
- Is it normal for a scheduled post to say “Missed Schedule”
- Manage multiple wordpress installs (Best Practice)
- Showing the next post’s title, even if it’s an unpublished post
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- Can’t publish posts, Jetpack won’t connect, empty notification emails to my inbox [closed]
- Duplicate post on publish
- How is it possible to use a very reduced version of WordPress?
- Problems in updating a self-developed plugin
- WordPress plugin to publish to multiple remote WordPress blogs
- How to trap “Publish” button to check for meta box validation?
- How to display and use all existing tags at my write-post-at-frontend-panel?
- Publish Post After Click On A Link
- Publish posts only after the condition is met
- How to add a checkbox inside the “Publish post” widget?
- How can I display a specific user’s first published post?
- Send email to user that his post has been rejected
- Action on post publish
- Every possible way to get data (posts) from WordPress
- Can I set a timer for pages to be published?
- How to run a function when post is edited or updated using publish post action?
- How to rename “Publish” metabox title in post screen
- Auto Publish On Cron
- count the total number of comments the user has received for his published posts
- Custom post type suppress transition from future to publish
- Decide user that can publish a post
- “Submit for review” for updates on existing posts
- Condition display metabox in case the post is saved
- Do action for only switch status for publish_post
- Setting dirty on customizer
- Check if post id exist in table than only update instead of inserting new row
- Display password protected posts to logged in users
- I want to print a message in post ” After one month from publish date”
- post.php AJAX request not being called when publishing post
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- how to execute some code after a post is published in WordPress [duplicate]
- Sort / display recent posts by publish date
- Post: how to set created date after post has been published [closed]
- trigger email when post is published by someone a user follows
- I am getting “0” in the starting of my post description at home page
- Publish box in CPT remove ‘edit’ link
- Send email to user when I publish a new post
- Why isn’t update_post_meta saving?
- If click on Save/Publish change Post Status to Pending Review instead Publish
- Front Page post mirroring revisions to other pages, constantly updating itself
- Create a new post on a specified publish date via link?
- suffix title with “EXPIRED” when scheduled post has reached it’s published date
- display wordpress user who published a pending post of another user
- Disable Facebook Comments Automatically On CPT
- Firing page_publish where page is child page
- problem with blank page
- Change event firing in wordpress
- check if a draft has been moved there from publish to draft
- I want my post to republish again after adding a custom field
- How to hook into publish_posttype?
- Check if there is an post to be published in future
- Edit the Publish Widget Options
- Plugin SVN folder structure
- Return All Post from publish to draft [duplicate]
- Output the published date / last modified date of specific page
- Create media folder upon post publish?
- Bulk post approval and publishing doesn’t work