WordPress.org

Make WordPress Core

Ticket #16358: 16358.diff

File 16358.diff, 1.5 KB (added by nacin, 2 years ago)
  • wp-includes/post.php

     
    6363                'rewrite' => false, 
    6464                'query_var' => false, 
    6565                'show_in_nav_menus' => false, 
    66                 'supports' => array( 'comments' ), 
     66                'supports' => array( 'comments', 'author' ), 
    6767        ) ); 
    6868 
    6969        register_post_type( 'revision', array( 
     
    8080                'rewrite' => false, 
    8181                'query_var' => false, 
    8282                'can_export' => false, 
     83                'supports' => array( 'author' ), 
    8384        ) ); 
    8485 
    8586        register_post_type( 'nav_menu_item', array( 
  • wp-admin/includes/user.php

     
    243243        do_action('delete_user', $id); 
    244244 
    245245        if ( 'novalue' === $reassign || null === $reassign ) { 
    246                 $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) ); 
     246                $post_types_to_delete = array(); 
     247                foreach ( get_post_types() as $post_type ) { 
     248                        if ( post_type_supports( $post_type, 'author' ) 
     249                                $post_types_to_delete[] = $post_type; 
     250                } 
     251                $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id ); 
     252                $post_types_to_delete = implode( "', '", $post_types_to_delete ); 
     253                $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id) ); 
    247254 
    248255                if ( $post_ids ) { 
    249256                        foreach ( $post_ids as $post_id )