Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Talk:Plugin API/Action Reference/save post

Custom Post Type Example

I'm confused about what this example code's doing. They add blank string as the HTTP POST nonce, then check user permission, and the nonce that was just set to empty string? I thought I saw the save_post was called near the end of the code, in Wordpress source, so isn't all this security checking redundant and unnecessary anyway, as the post is already saving?


I've removed the portions of the examples with the nonce and current_user_can() checks. Like you say, this is redundant. The post has already been saved when this action is called, so there's no reason to clutter up example code with these unnecessary checks.
Jdgrimes 20:18, 25 August 2013 (UTC)

Return Values

Some actions require return values, but this one seems like it doesn't (there is no function save_post(args...). Am I right? If so, it would be helpful to include this information. Nyodulf (talk)


No, actions never return values. You are thinking of filters.
-Jdgrimes (talk) 15:44, 16 October 2014 (UTC)