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
- Is there a save_post hook for custom post types?
- Where is the right place to register/enqueue scripts & styles
- Difference between do_action and add_action
- Difference between after_setup_theme and init action hooks?
- get $post in init filter or action?
- How to intercept a 404 error
- Move excerpt meta box to above content editor
- Trigger custom action when setting button pressed
- Which hook if user profile information is updated?
- Are hooks called synchronously?
- How to access the post meta of a post that has just been published?
- Disable block from editor based on post type
- Difference between hooks Plugin_loaded and admin_int?
- How to programmatically create a connection with [Plugin: Posts 2 Posts] on cpt publish?
- How to show an error message after publishing a post?
- Make W3 Total Cache “Empty All Caches” function purge varnish [closed]
- How to inject content after
- Better post meta efficiency?
- How to debug removal of rewrite rule flushing?
- add_action on inherit post status
- 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
- Redirect users on specific post category or category page
- Stuck in redirect loop after using wp_login action
- 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
- `rest_user_query` can’t access post author in post edit screen
- Add nofollow to custom widget posts
- Change Password Confirmed Email Text
- How do I trigger a post update within a get_posts() foreach loop?
- Register form: add custom field BEFORE default fields
- Custom Front End Registration – How Does the Key work in the Password Set Request?
- Lock user information once fields have been filled in
- 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?
- 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
- hook for loading page
- What hook to use to redirect based on $post
- How to call do_action() to pass arguments to hooked functions that take different number of args?
- 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?
- 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?
- theme functions (hooks)
- frontend show edit profile with selected custom options
- How to change Akismet commenter privacy notice?
- How To Apply Different Styles To All Blocks Based on Post Meta Value?
- change position of element using hook [closed]
- The acction hook stop working if i move it from plugin file to theme’s functions.php file
- How to add action in wordpress custom plugin?
- How can I add new attributes in a Class when my addon is active?
- wp_footer content appearing in admin area
- Get post ID before add_theme_support