Ticket #19292: 19292.diff
File 19292.diff, 1.7 KB (added by , 13 years ago) |
---|
-
wp-includes/post.php
2485 2485 // Create a valid post name. Drafts and pending posts are allowed to have an empty 2486 2486 // post name. 2487 2487 if ( empty($post_name) ) { 2488 $sanitize_context = $update && is_post_type_hierarchical( $post_type ) ? '' : 'save'; 2488 2489 if ( !in_array( $post_status, array( 'draft', 'pending', 'auto-draft' ) ) ) 2489 $post_name = sanitize_title($post_title );2490 $post_name = sanitize_title($post_title, '', $sanitize_context ); 2490 2491 else 2491 2492 $post_name = ''; 2492 2493 } else { 2493 $post_name = sanitize_title( $post_name);2494 $post_name = sanitize_title( $post_name, '', $sanitize_context ); 2494 2495 } 2495 2496 2496 2497 // If the post date is empty (due to having been new or a draft) and status is not 'draft' or 'pending', set date to now … … 2594 2595 } 2595 2596 2596 2597 if ( empty($data['post_name']) && !in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { 2597 $data['post_name'] = sanitize_title($data['post_title'], $post_ID );2598 $data['post_name'] = sanitize_title($data['post_title'], $post_ID, $update && is_post_type_hierarchical( get_post_type( $post_ID ) ) ? '' : 'save' ); 2598 2599 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 2599 2600 } 2600 2601 … … 3153 3154 $page_path = str_replace('%20', ' ', $page_path); 3154 3155 $parts = explode( '/', trim( $page_path, '/' ) ); 3155 3156 $parts = array_map( 'esc_sql', $parts ); 3156 $parts = array_map( 'sanitize_title ', $parts );3157 $parts = array_map( 'sanitize_title_for_query', $parts ); 3157 3158 3158 3159 $in_string = "'". implode( "','", $parts ) . "'"; 3159 3160 $post_type_sql = $post_type;