Make WordPress Core

Ticket #26809: 26809.patch

File 26809.patch, 1.8 KB (added by dllh, 11 years ago)

Changes that sort of fix the example (not submitted as a true fix, though)

  • wp-includes/post.php

     
    28792879        $data = wp_unslash( $data );
    28802880        $where = array( 'ID' => $post_ID );
    28812881
     2882        if ( !empty($page_template) && 'page' == $data['post_type'] ) {
     2883                $post->page_template = $page_template;
     2884                $page_templates = wp_get_theme()->get_page_templates();
     2885                if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) {
     2886                        if ( $wp_error )
     2887                                return new WP_Error('invalid_page_template', __('The page template is invalid.'));
     2888                        else {
     2889                                return 0;
     2890                }
     2891        }
     2892
    28822893        if ( $update ) {
    28832894                do_action( 'pre_post_update', $post_ID, $data );
    28842895                if ( false === $wpdb->update( $wpdb->posts, $data, $where ) ) {
     
    29422953        $post = get_post($post_ID);
    29432954
    29442955        if ( !empty($page_template) && 'page' == $data['post_type'] ) {
    2945                 $post->page_template = $page_template;
    2946                 $page_templates = wp_get_theme()->get_page_templates();
    2947                 if ( 'default' != $page_template && ! isset( $page_templates[ $page_template ] ) ) {
    2948                         if ( $wp_error )
    2949                                 return new WP_Error('invalid_page_template', __('The page template is invalid.'));
    2950                         else
    2951                                 return 0;
    2952                 }
    29532956                update_post_meta($post_ID, '_wp_page_template',  $page_template);
    29542957        }
    29552958
  • wp-admin/includes/post.php

     
    278278
    279279        update_post_meta( $post_ID, '_edit_last', get_current_user_id() );
    280280
    281         wp_update_post( $post_data );
     281        $status = wp_update_post( $post_data, true );
     282        if ( is_wp_error( $status ) ) {
     283                wp_die( $status->get_error_message() );
     284        }
    282285
    283286        // Now that we have an ID we can fix any attachment anchor hrefs
    284287        _fix_attachment_links( $post_ID );