Here is the description of transition_post_status
from the codex:
This function’s access is marked as private. That means it is not
intended for use by plugin and theme developers, but only in other
core functions. It is listed here for completeness. Use any of these
functions instead.
Why not use the publish_post
action instead? There is a nice article + example in the codex which covers your case. It sends an email whenever a post is published and sends the post data.
Edit 1: As @Pieter Goosen pointed I’ve looked at different function (_transition_post_status()
instead of the hook transition_post_status
). Please disregard my post about it’s description. Sorry for the confusion!
Related Posts:
- Access post meta just after publishing
- How to hook update_post_meta and delete_post_meta?
- What is the difference between update_post_meta and update_postmeta hooks?
- How to call a REST endpoint when a post is published?
- Returning ACF custom field from publish_post
- Update post meta using pending_to_publish hook
- new_to_publish fires multiple times
- Post Meta Emtpy on Publish Using Transition
- get_post_metadata causing some meta data to fail
- I would like to send a notification email (Asana) whenever something is published (posts, pages, custom post types) [duplicate]
- add_action hook for publish_post not working
- run script on publish
- post.php AJAX request not being called when publishing post
- How to stop WordPress from updating the post meta
- Where is publish_post hook fired?
- Custom posts and get_post_meta in {$post_status}_{$post_type}
- Post via wp-admin and via iOS app, same hooks and triggers involved?
- calculate values from a field and insert them into custom fields when publishing or updating post
- Why does get_post() not return anything?
- WP-Automatic to run publish hooks
- disable publish button until condition is not met
- How to hook into publish_posttype?
- Function is Missing an Action Hook
- Where can I find a list of WordPress hooks?
- Whats worth using add_action when we can simply use add_filter?
- add_action(‘wp_ajax_[action name]’, myfunction) problem
- Hook on trash post
- Adding onload to body
- What is the earliest possible hook for safely using `is_front_page`?
- Send data to 3rd party api with wp_remote_post on wp_login
- How to customize the WP admin default help contents
- Hide gutenberg option blocks
- Difference between hooks Plugin_loaded and admin_int?
- admin_post hook not called
- deactivated_plugin hook: get the name of the plugin
- Is there a hook for user activation (after they click the email confirm)?
- Setcookie works on admin but not front end
- How to debug removal of rewrite rule flushing?
- function ‘wp_enable_block_templates’ not found
- How can I add a default description to uploaded files?
- Hook Widget to Woo Theme in functions.php
- Security around save_post hook
- How to pass arguments to add_action() [duplicate]
- How to use the post_updated hook before and after arguments
- I don’t understand why I shoud use lostpassword_url hook?
- How to get session token of current user in wp_login hook?
- Hook any php file into the wordpress api
- WP CLI Get all Enqueued Scripts and Styles
- Delay an action until current action is completed
- How to properly setup an activation hook
- How to remove scripts/style added to customize_controls_enqueue_scripts hook by current active theme
- Help to change the text for new website notification (wpmu_welcome_notification)
- How to remove query string from current page URL?
- Plugins rewrite rules the right way
- Strange behaviour with add_{$meta_type}_metadata | add_post_metadata filter
- Plugin init hook
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- How to check post type when using sanitize_title hook?
- Register form: add custom field BEFORE default fields
- Custom Front End Registration – How Does the Key work in the Password Set Request?
- How to change the default mail when admin approuved an user?
- Lock user information once fields have been filled in
- How do I prevent term from being created on create_term hook?
- save_post hook to add terms getting deleted when using bulk edit
- Add Different Actions To Different Page’s wp_footer
- Getting the post ID in parse_query
- Remove genesis_404 hook from genesis_loop [closed]
- What hooks do I need to hook into to capture ever wp_user creation/change?
- Is there a before_save_post hook or something similar
- Add a custom class to the body tag using custom fields
- Neccessary to call add_submenu_page and add_menu_page from admin_menu hook?
- Adding custom Bulk Actions
- Print results of a WP_Query to wp-admin/upload.php within ‘delete_attachment’ hook?
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- WP hook to add custom content after the_title()
- Is it likely that do_action will have unexpected results?
- How to export category name and category link in wordpress json
- Error later wordpress 5.3.2 update. Please help
- How to abort a save operation with a WordPress hook?
- wp_get_current_user Not working
- is_page not triggering
- admin_post_(action) hook create console log error
- Check if front page within function passed to action
- Hook after creating a post and retrieve infos from this post immediatly
- $new_pass always returns null – password_reset hook
- How to resolve 500 error in post listing page?
- Object oriented programming, add_action in constructor not firing
- change attachment custom field onChange event
- Get new (not old) post inside transition_post_status hook
- How to Show Different Information to your authors/contributers
- Cannot override hooks.php
- Removing action from template class
- Remove “enqueued” script from array
- How to access variables in the function where apply_filters() is called?
- PHP Notice: wp_enqueue_script was called incorrectly. Scripts and styles should not be registered
- getSaveContent.extraProps hook for core/post-title doesn’t add new attributes on to the frontend
- Removing script tags that are loaded by other script tag
- Does wp_login hook fire on user registration?
- wp_trash_post not firing as expected (also applies to trashed_post)