Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: wp_creating_autosave

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
349
350                if ( ! $autosave_is_different ) {
351                     wp_delete_post_revision( $old_autosave->ID );
352                     return new WP_Error( 'rest_autosave_no_changes', __( 'There is nothing to save. The autosave and the post content are the same.' ), array( 'status' => 400 ) );
353                }
354
355                /**
356                 * This filter is documented in wp-admin/post.php.
357                 */
358                do_action( 'wp_creating_autosave', $new_autosave );
359
360                // wp_update_post expects escaped array.
361                return wp_update_post( wp_slash( $new_autosave ) );
362           }
363
364           // Create the new autosave as a special post revision.
365           return _wp_put_post_revision( $post_data, true );
366      }
367