It comes from wp_insert_post()
, where do_action()
is called with two additional parameters:
do_action('save_post', $post_ID, $post);
So it is not you who adds the parameters, it is WordPress.
If you register your callback with the fourth parameter set to 2
…
add_action( 'save_post', 'mytestfunc', 10, 2 );
… you will even get the complete $post
object:
function mytestfunc( $post_id, $post )
Related Posts:
- How to manage saving custom field from Quick edit and Post Save using save_post action hook without colliding each other?
- pass error to admin_notices on “quick edit”/save_post action
- Check for update vs new post on save_post action
- How to avoid infinite loop in save_post callback
- $update is always true in save_post
- Action hook ‘save_post’ triggered when deleting posts
- get post meta before it is updated (during SAVE_POST)
- How to verify nonce from Bulk/Quick Edit in save_post?
- save_post action firing before I publish / save the post
- save_post action only when creating a new post
- Check if value has changed on save_post
- Action ‘save_post’ not working for quick edit
- Minimum Word Count Before A Post Can Be Made Pending Review
- update_post_meta() not working in save_post
- How do I save each option in a multiple select menu as it’s own meta_key + meta_value pair?
- Update post on save
- Post meta checkbox becomes unchecked occasionally
- Return code from save_post action?
- update_post_meta not working in save_post
- save_post only saves meta data on second save
- Get Post ID with insert/edit link
- Why save_post_$(custom_post_type) is fired even if I am not already saving a post?
- Set the value of custom field when post is published or updated
- How to get post bulk edit action trigger and get edited post ids?
- save_post requiere at least one uploaded file to be published
- Get $_POST & $_REQUEST values before adding/updating post
- How can I create a new user account while creating a new post, and then set that new user as the author of that new post?
- Validate post checking if child term is assigned
- Clear cache on post of one type when something happens to post of other type
- Why not fire the save_post event?
- Compare custom taxonomies of updated post (or new post) [Updated with progress]
- WordPress 4.9.8 doesn’t save if content has style=”
- Reset all transients on post or page save
- Using PODS data with save_post
- Cant’t delete my custom posts
- Update current WP post every 3 minutes [closed]
- Changing new post to “pending” on publish – but “Publish failed” – why?
- update_post_meta not working in foreach
- Save post in another table
- Strange bug on post/page save
- draft_to_pending action doesn’t seem to fire
- What action to use for when a post is saved / published, with a caveat
- Custom wp_editor doesn’t update post_content
- Save custom value to main content of post
- Check for page template on save_post hook
- Access NEW/UPDATED post values in save_post() callback function
- woocommerce_product_quick_edit_save hook not fired
- save button grayed out randomly
- Post editor doesn’t save embed media [closed]
- How to get a post meta value and pass that to update_option when a post is created or updated?
- WordPress save meta data : Displaying the word Array when selected
- Save current post using custom save button
- Connection Reset on post/page save
- Meta data not saved on save_post
- Insert/Update DB table when making new post or update older one
- Prevent Page/Post From Being Created based on Pages/Posts per User per Time Unit
- How to debug | Some times the “Save Draft” button seems to spin but does not actually save
- My custom title gets duplicated at every save or post update
- Use save_post to generate file on wordpress
- Detect, if post is saved manually or programmatically in save_post-hook
- Using save_post to replace the post’s title
- Disable “quick edit” only for non admin in functions.php
- Force post slug to be auto generated from title on save
- Hook to process a new taxonomy tag before it is created?
- How to assign default taxonomy to pages on ‘save_post’?
- How to get and edit custom fields if in Quick Edit
- wp_insert_posts Fatal error: Maximum function nesting level of ‘100’ reached, aborting!
- How to add a custom field to quick edit
- Undefined variable post_id in custom quick edit coloumn
- Correct processing of `$_POST`, following WordPress Coding Standards
- Frontend posting – everything saves other than checkboxes?
- wp_insert_post_data filter not working correctly after upgrade to WordPress 5
- How to make all the posts commentable by default? Imputs in Settings/Discussions are not saved
- How to unset fields in woocommerce product quick edit?
- Strange issue saving custom field data for a WooCommerce order
- Use jQuery to conditionally hide elements in Quick Edit
- WP_Terms_List_Table Quick Edit not working
- Why does post-slug not get saved for drafts?
- WordPress custom admin notice still displays after wp_insert_post_data validation
- How to notify specific users when i’m posting/modifying a new post
- Saving zero as meta value
- disable quickedit for specific custom post type user role
- When the new post which has no image published, save the specific image as the featured image ( by category )
- How to register a widget when saving a post?
- save radio button selection in post-meta on submit
- Save / Update meta data as multidimensional array
- WordPress sent multiple requests on update
- Use value from ACF to populate other fields
- Execute php after post save/update
- Saving multiple fields (dropdown and text) in custom metabox
- Updating failed message when a wp_insert_post function is hooked to save_post hook
- WordPress dosn’t save page/post updates
- problem when uploading file by metaboxes
- How to stop post status from reverting to Published?
- Error 404 when saving or previewing one specific page [closed]
- Update post_meta post_name with the post ID from wp_insert_post after user register
- Saving metadata of related post on save_post
- added a meta box to post however when saving menu while debug on throws a warning
- Using set_post_thumbnail inside save_post action gets overwritten
- How can I change the location where the custom field is displayed in the Quick Edit tab in WordPress