save_post is an action triggered whenever a post or page is created or updated, which could be from an import, post/page edit form, xmlrpc, or post by email. The data for the post is stored in $_POST, $_GET or the global $post_data, depending on how the post was edited.

learn more… | top users | synonyms

6
votes
2answers
4k views

Set custom messages for post update/save

I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it!
0
votes
1answer
335 views

Custom field values get deleted

I created a custom post type:products which also has custom fields: price & shipping. Occasionally, if I leave the edit product window open or refresh it, I lose the values inside price and ...
3
votes
2answers
662 views

Why can't I hook into save_posts after admin_init?

I'm trying to hook into the "save_post" action from an AJAX callback in my plugin, but it doesn't seem to work. In fact, hooking into "save_posts" only seems to work from a few key action execution ...
1
vote
3answers
2k views

Conflicting save_post functions when passing the post id and saving custom meta boxes for different post types

Post save functions are conflicting with each other when adding them to the save_post action hook. 2 different custom post types with 2 different (one for each post type) custom meta boxes. I'm ...
10
votes
3answers
6k views

Passing error/warning messages from a meta box to “admin_notices”

I have a simple meta box that updates the post custom fields (using update_post_meta()). How can I send a error or warning message to the next page after the user publishes/updates the post and ...
7
votes
2answers
2k views

Return $post_id when DOING_AUTOSAVE?

I see the following pattern over and over, on this site and on other places: add_action( 'save_post', 'wpse14169_save_post' ); function wpse14169_save_post( $post_id ) { if ( defined( ...
2
votes
2answers
461 views

Trigger “unsaved changes” dialog for custom post meta changes

I'm using a custom post type with custom meta fields, but autosave and the "unsaved changes" dialog don't seem to be triggered for these custom meta fields. Autosave isn't as important to me as the ...
1
vote
2answers
741 views

Metabox saves on Update or Publish, but not on Saving Draft

I have created custom post types that also have custom meta_boxes I've created. Currently, they save when I publish or update a post, but they don't save when I'm in draft mode making changes. ...
0
votes
1answer
306 views

help intercepting save_post through plugin

I use stackoverflow very often and just found out in google about this one, Nice :D Well, i want to save my every post i write from wordpress to my 3rd (OEXChangeble) website aswell at the same time, ...
3
votes
2answers
741 views

Submitting posts from the front end - sanitizing data

I have a form that allows any registered user to submit a post (it's a custom post type - forum related), and I'm using wp_insert_post() to insert it into the db. From what I've seen in this function ...
1
vote
1answer
178 views

save_post requiere at least one uploaded file to be published

Is there a way to check the Published status of a post, and if it doesnt has at least one image or file uploaded, then change status of published to draft? Thanks in advance.
20
votes
6answers
11k views

Add validation and error handling when saving custom fields?

I have a function that defines a custom field on a post type. Say the field is "subhead". When the post is saved, I want to do some validation on the input, and display an error message on the post ...
1
vote
2answers
2k views

How can I pass $post object to 'save_post' add_action?

I have several functions that are called from inside a save_post function. However, all of the functions that use the $post object are returning incorrect values because it appears that the default ...