@@ -1295,10 +1295,31 @@ private function _toggle_sticky( $post_data, $update = false ) {
1295
1295
* @return IXR_Error|string
1296
1296
*/
1297
1297
protected function _insert_post ( $ user , $ content_struct ) {
1298
- $ defaults = array ( 'post_status ' => 'draft ' , 'post_type ' => 'post ' , 'post_author ' => 0 ,
1299
- 'post_password ' => '' , 'post_excerpt ' => '' , 'post_content ' => '' , 'post_title ' => '' );
1298
+ $ defaults = array (
1299
+ 'post_status ' => 'draft ' ,
1300
+ 'post_type ' => 'post ' ,
1301
+ 'post_author ' => null ,
1302
+ 'post_password ' => null ,
1303
+ 'post_excerpt ' => null ,
1304
+ 'post_content ' => null ,
1305
+ 'post_title ' => null ,
1306
+ 'post_date ' => null ,
1307
+ 'post_date_gmt ' => null ,
1308
+ 'post_format ' => null ,
1309
+ 'post_name ' => null ,
1310
+ 'post_thumbnail ' => null ,
1311
+ 'post_parent ' => null ,
1312
+ 'ping_status ' => null ,
1313
+ 'comment_status ' => null ,
1314
+ 'custom_fields ' => null ,
1315
+ 'terms_names ' => null ,
1316
+ 'terms ' => null ,
1317
+ 'sticky ' => null ,
1318
+ 'enclosure ' => null ,
1319
+ 'ID ' => null ,
1320
+ );
1300
1321
1301
- $ post_data = wp_parse_args ( $ content_struct , $ defaults );
1322
+ $ post_data = wp_parse_args ( array_intersect_key ( $ content_struct, $ defaults ) , $ defaults );
1302
1323
1303
1324
$ post_type = get_post_type_object ( $ post_data ['post_type ' ] );
1304
1325
if ( ! $ post_type )
@@ -1488,9 +1509,6 @@ protected function _insert_post( $user, $content_struct ) {
1488
1509
1489
1510
$ post_data ['tax_input ' ] = $ terms ;
1490
1511
unset( $ post_data ['terms ' ], $ post_data ['terms_names ' ] );
1491
- } else {
1492
- // Do not allow direct submission of 'tax_input', clients must use 'terms' and/or 'terms_names'.
1493
- unset( $ post_data ['tax_input ' ], $ post_data ['post_category ' ], $ post_data ['tags_input ' ] );
1494
1512
}
1495
1513
1496
1514
if ( isset ( $ post_data ['post_format ' ] ) ) {
0 commit comments