Ticket #18692: post.php.diff
| File post.php.diff, 1.9 KB (added by sirzooro, 21 months ago) |
|---|
-
wp-includes/post.php
2554 2554 // expected_slashed (everything!) 2555 2555 $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' ) ); 2556 2556 $data = apply_filters('wp_insert_post_data', $data, $postarr); 2557 if ( is_wp_error ( $data ) ) { 2558 if ( $wp_error ) 2559 return $data; 2560 else 2561 return 0; 2562 } 2557 2563 $data = stripslashes_deep( $data ); 2558 2564 $where = array( 'ID' => $post_ID ); 2565 2566 // categories 2567 $post_category = apply_filters( 'wp_insert_post_category', $post_category ); 2568 if ( is_wp_error ( $post_category ) ) { 2569 if ( $wp_error ) 2570 return $post_category; 2571 else 2572 return 0; 2573 } 2574 // make sure we set a valid category 2575 if ( empty( $post_category ) || 0 == count( $post_category ) || !is_array( $post_category ) ) { 2576 // 'post' requires at least one category. 2577 if ( 'post' == $post_type && 'auto-draft' != $post_status ) 2578 $post_category = array( get_option( 'default_category' ) ); 2579 else 2580 $post_category = array(); 2581 } 2582 // old-style tags_input 2583 if ( !empty( $tags_input ) ) { 2584 $tags_input = apply_filters( 'wp_insert_post_tags', $tags_input ); 2585 } 2586 if ( is_wp_error ( $tags_input ) ) { 2587 if ( $wp_error ) 2588 return $tags_input; 2589 else 2590 return 0; 2591 } 2592 // new-style support for all tag-like taxonomies 2593 $tax_input = apply_filters( 'wp_insert_post_tax', empty( $tax_input ) ? array() : $tax_input ); 2594 if ( is_wp_error ( $tax_input ) ) { 2595 if ( $wp_error ) 2596 return $tax_input; 2597 else 2598 return 0; 2599 } 2559 2600 2560 2601 if ( $update ) { 2561 2602 do_action( 'pre_post_update', $post_ID );