Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: autosave_interval

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
14                wp_die( __('You are not allowed to edit this post.' ));
15      }
16
17      // Autosave shouldn't save too soon after a real save
18      if ( 'autosave' == $_POST['action'] ) {
19           $post =& get_post( $post_ID );
20           $now = time();
21           $then = strtotime($post->post_date_gmt . ' +0000');
22           // Keep autosave_interval in sync with autosave-js.php.
23           $delta = apply_filters( 'autosave_interval', 120 ) / 2;
24           if ( ($now - $then) < $delta )
25                return $post_ID;
26      }
27
28      // Rename.
29      $_POST['ID'] = (int) $_POST['post_ID'];
30      $_POST['post_content'] = $_POST['content'];
31      $_POST['post_excerpt'] = $_POST['excerpt'];
32      $_POST['post_parent'] = $_POST['parent_id'];