Ticket #19373: patch-boolean.diff
File patch-boolean.diff, 1.6 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
2412 2412 * @param bool $wp_error Optional. Allow return of WP_Error on failure. 2413 2413 * @return int|WP_Error The value 0 or WP_Error on failure. The post ID on success. 2414 2414 */ 2415 function wp_insert_post($postarr, $wp_error = false ) {2415 function wp_insert_post($postarr, $wp_error = false, $sanitize = true) { 2416 2416 global $wpdb, $wp_rewrite, $user_ID; 2417 2417 2418 2418 $defaults = array('post_status' => 'draft', 'post_type' => 'post', 'post_author' => $user_ID, … … 2425 2425 2426 2426 unset( $postarr[ 'filter' ] ); 2427 2427 2428 $postarr = sanitize_post($postarr, 'db'); 2428 if ( $sanitize ) { 2429 $postarr = sanitize_post($postarr, 'db'); 2430 } 2429 2431 2430 2432 // export array as variables 2431 2433 extract($postarr, EXTR_SKIP); … … 2479 2481 } 2480 2482 2481 2483 // Don't allow contributors to set the post slug for pending review posts 2482 if ( 'pending' == $post_status && !current_user_can( 'publish_posts' ) )2484 if ( 'pending' == $post_status && $sanitize && !current_user_can( 'publish_posts' ) ) 2483 2485 $post_name = ''; 2484 2486 2485 2487 // Create a valid post name. Drafts and pending posts are allowed to have an empty … … 2615 2617 $taxonomy_obj = get_taxonomy($taxonomy); 2616 2618 if ( is_array($tags) ) // array = hierarchical, string = non-hierarchical. 2617 2619 $tags = array_filter($tags); 2618 if ( current_user_can($taxonomy_obj->cap->assign_terms) )2620 if ( !$sanitize || current_user_can($taxonomy_obj->cap->assign_terms) ) 2619 2621 wp_set_post_terms( $post_ID, $tags, $taxonomy ); 2620 2622 } 2621 2623 }