Make WordPress Core

Ticket #19292: 19292-dont-update-slug-sanitize-type-on-update.diff

File 19292-dont-update-slug-sanitize-type-on-update.diff, 1.2 KB (added by dd32, 13 years ago)
  • wp-includes/post.php

     
    24902490                else
    24912491                        $post_name = '';
    24922492        } else {
    2493                 $post_name = sanitize_title($post_name);
     2493                // On updates, we need to check to see if it's using an old sanitization context, or the newer Save context
     2494                $check_name = sanitize_title(urlencode($post_name), '', 'query'); // sanitize_title_for_query(), but spelt out here for readability
     2495                if ( $update && strtolower(urlencode($post_name)) == $check_name )
     2496                        $post_name = $check_name;
     2497                else // slug has changed or uses newer (default) sanitization
     2498                        $post_name = sanitize_title($post_name);
    24942499        }
    24952500
    24962501        // 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
     
    31533158        $page_path = str_replace('%20', ' ', $page_path);
    31543159        $parts = explode( '/', trim( $page_path, '/' ) );
    31553160        $parts = array_map( 'esc_sql', $parts );
    3156         $parts = array_map( 'sanitize_title', $parts );
     3161        $parts = array_map( 'sanitize_title_for_query', $parts );
    31573162
    31583163        $in_string = "'". implode( "','", $parts ) . "'";
    31593164        $post_type_sql = $post_type;