Make WordPress Core

Ticket #64507: author_name_string.patch

File author_name_string.patch, 942 bytes (added by leedxw, 2 months ago)

patch to check if author_name is a string

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

    old new  
    24182418
    24192419                // Author stuff for nice URLs.
    24202420
    2421                 if ( '' !== $query_vars['author_name'] ) {
     2421                if ( '' !== $query_vars['author_name'] && is_string( $query_vars['author_name'] ) ) {
    24222422                        if ( str_contains( $query_vars['author_name'], '/' ) ) {
    24232423                                $query_vars['author_name'] = explode( '/', $query_vars['author_name'] );
    24242424                                if ( $query_vars['author_name'][ count( $query_vars['author_name'] ) - 1 ] ) {
     
    40394039                        $this->queried_object_id = (int) $this->post->ID;
    40404040                } elseif ( $this->is_author ) {
    40414041                        $author      = (int) $this->get( 'author' );
    4042                         $author_name = $this->get( 'author_name' );
     4042                        $author_name = ( is_string( $this->get( 'author_name' ) ) ) ? $this->get( 'author_name' ) :  false;
    40434043
    40444044                        if ( $author ) {
    40454045                                $this->queried_object_id = $author;