Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_post_update

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
2870      $post_name = wp_unique_post_slug($post_name, $post_ID, $post_status, $post_type, $post_parent);
2871
2872      // expected_slashed (everything!)
2873      $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'guid' ) );
2874      $data = apply_filters('wp_insert_post_data', $data, $postarr);
2875      $data = wp_unslash( $data );
2876      $where = array( 'ID' => $post_ID );
2877
2878      if ( $update ) {
2879           do_action( 'pre_post_update', $post_ID, $data );
2880           if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
2881                if ( $wp_error )
2882                     return new WP_Error('db_update_error', __('Could not update post in the database'), $wpdb->last_error);
2883                else
2884                     return 0;
2885           }
2886      } else {
2887           if ( isset($post_mime_type) )
2888                $data['post_mime_type'] = wp_unslash( $post_mime_type ); // This isn't in the update