Ticket #31168: 31168-b.patch
File 31168-b.patch, 2.1 KB (added by , 9 years ago) |
---|
-
src/wp-admin/includes/upgrade.php
227 227 'post_type' => 'page', 228 228 'to_ping' => '', 229 229 'pinged' => '', 230 'post_content_filtered' => '' 230 'post_content_filtered' => '', 231 'comment_status' => 'closed', 231 232 )); 232 233 $wpdb->insert( $wpdb->postmeta, array( 'post_id' => 2, 'meta_key' => '_wp_page_template', 'meta_value' => 'default' ) ); 233 234 -
src/wp-includes/post.php
3088 3088 'guid' => '', 'post_content_filtered' => '', 'post_excerpt' => '', 'import_id' => 0, 3089 3089 'post_content' => '', 'post_title' => '', 'context' => ''); 3090 3090 3091 if ( !empty( $postarr['post_type'] ) && $postarr['post_type'] == 'page' ) { 3092 $defaults['ping_status'] = 'closed'; 3093 } 3094 3091 3095 $postarr = wp_parse_args($postarr, $defaults); 3092 3096 3093 3097 unset( $postarr[ 'filter' ] ); … … 3258 3262 } 3259 3263 3260 3264 if ( empty( $postarr['comment_status'] ) ) { 3261 if ( $update ) {3265 if ( $update || $post_type == 'page' ) { 3262 3266 $comment_status = 'closed'; 3263 3267 } else { 3264 3268 $comment_status = get_option('default_comment_status'); -
tests/phpunit/tests/post.php
1068 1068 $this->assertEquals( $post->$field, $value ); 1069 1069 } 1070 1070 } 1071 1072 /** 1073 * @ticket 31168 1074 */ 1075 function test_wp_insert_post_page_default_comment_ping_status() { 1076 $args = array( 1077 'post_type' => 'page', 1078 'post_title' => 'Example Page', 1079 'post_status' => 'publish', 1080 ); 1081 $post_id = $this->factory->post->create( $args ); 1082 $page = get_post( $post_id ); 1083 1084 $this->assertEquals( 'closed', $page->comment_status ); 1085 $this->assertEquals( 'closed', $page->ping_status ); 1086 } 1071 1087 }