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( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
return $post_id;
}
// Other code...
}
Why should I return $post_id
? save_post
is an action, and the return value of an action handler is ignored. The WordPress core itself doesn't do it either.
The Codex example does return the $post_id
, but it would not be the first incorrect (or outdated) line in the Codex.
Am I missing something? Do I need to return $post_id
? Was there a there a time when this was needed?