Make WordPress Core

Ticket #38709: core.patch

File core.patch, 595 bytes (added by rebasaurus, 21 months ago)

Maybe I'm oversimplifying it, but could the fix be just checking the value after it has ran through sanitize_title_for_query()?

  • src/wp-includes/class-wp-query.php

    diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php
    index 0f29f1f3a3..1d99403eb2 100644
    a b class WP_Query { 
    20872087                }
    20882088
    20892089                // Parameters related to 'post_name'.
    2090                 if ( '' !== $q['name'] ) {
    2091                         $q['name'] = sanitize_title_for_query( $q['name'] );
     2090                if ( '' !== sanitize_title_for_query( $q['name'] ) ) {
    20922091                        $where    .= " AND {$wpdb->posts}.post_name = '" . $q['name'] . "'";
    20932092                } elseif ( '' !== $q['pagename'] ) {
    20942093                        if ( isset( $this->queried_object_id ) ) {