Switch to sanitize_title_for_query() for Query sanitization (allows for pre-3.3 page slugs to be viewable), Don't update page slugs to new slug-types when the slug is not being changed, Don't issue a XHR if the page slug hasn't changed. Group effort props xknown, markjaquith, nacin. See #19292

git-svn-id: https://develop.svn.wordpress.org/trunk@19444 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Dion Hulse
2011-11-24 00:20:21 +00:00
parent 073e1df1f0
commit d70ddc49f9
5 changed files with 14 additions and 6 deletions
+7 -2
View File
@@ -2490,7 +2490,12 @@ function wp_insert_post($postarr, $wp_error = false) {
else
$post_name = '';
} else {
$post_name = sanitize_title($post_name);
// On updates, we need to check to see if it's using the old, fixed sanitization context.
$check_name = sanitize_title( $post_name, '', 'old-save' );
if ( $update && strtolower( urlencode( $post_name ) ) == $check_name && get_post_field( 'post_name', $ID ) == $check_name )
$post_name = $check_name;
else // new post, or slug has changed.
$post_name = sanitize_title($post_name);
}
// 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
@@ -3153,7 +3158,7 @@ function get_page_by_path($page_path, $output = OBJECT, $post_type = 'page') {
$page_path = str_replace('%20', ' ', $page_path);
$parts = explode( '/', trim( $page_path, '/' ) );
$parts = array_map( 'esc_sql', $parts );
$parts = array_map( 'sanitize_title', $parts );
$parts = array_map( 'sanitize_title_for_query', $parts );
$in_string = "'". implode( "','", $parts ) . "'";
$post_type_sql = $post_type;