Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: autosave_generate_nonces

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
1000      ) );
1001      $x->send();
1002      break;
1003 case 'autosave-generate-nonces' :
1004      check_ajax_referer( 'autosave', 'autosavenonce' );
1005      $ID = (int) $_POST['post_ID'];
1006      $post_type = ( 'page' == $_POST['post_type'] ) ? 'page' : 'post';
1007      if ( current_user_can( "edit_{$post_type}", $ID ) )
1008           die( json_encode( array( 'updateNonce' => wp_create_nonce( "update-{$post_type}_{$ID}" ), 'deleteURL' => str_replace( '&', '&', wp_nonce_url( admin_url( $post_type . '.php?action=trash&post=' . $ID ), "trash-{$post_type}_{$ID}" ) ) ) ) );
1009      do_action('autosave_generate_nonces');
1010      die('0');
1011 break;
1012 case 'closed-postboxes' :
1013      check_ajax_referer( 'closedpostboxes', 'closedpostboxesnonce' );
1014      $closed = isset( $_POST['closed'] ) ? $_POST['closed'] : '';
1015      $closed = explode( ',', $_POST['closed'] );
1016      $hidden = isset( $_POST['hidden'] ) ? $_POST['hidden'] : '';
1017      $hidden = explode( ',', $_POST['hidden'] );
1018      $page = isset( $_POST['page'] ) ? $_POST['page'] : '';