File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -878,6 +878,10 @@ public function parse_query( $query = '' ) {
878878
879879 $ query_vars ['attachment_id ' ] = is_scalar ( $ query_vars ['attachment_id ' ] ) ? absint ( $ query_vars ['attachment_id ' ] ) : 0 ;
880880
881+ if ( ! is_scalar ( $ query_vars ['attachment ' ] ) ) {
882+ $ query_vars ['attachment ' ] = '' ;
883+ }
884+
881885 if ( ( '' !== $ query_vars ['attachment ' ] ) || ! empty ( $ query_vars ['attachment_id ' ] ) ) {
882886 $ this ->is_single = true ;
883887 $ this ->is_attachment = true ;
@@ -2152,11 +2156,17 @@ public function get_posts() {
21522156
21532157 if ( ! $ ptype_obj ->hierarchical ) {
21542158 // Non-hierarchical post types can directly use 'name'.
2155- $ query_vars ['name ' ] = $ query_vars [ $ ptype_obj ->query_var ];
2159+ if ( is_scalar ( $ query_vars [ $ ptype_obj ->query_var ] ) ) {
2160+ $ query_vars ['name ' ] = $ query_vars [ $ ptype_obj ->query_var ];
2161+ } else {
2162+ $ query_vars ['name ' ] = '' ;
2163+ }
21562164 } else {
21572165 // Hierarchical post types will operate through 'pagename'.
2158- $ query_vars ['pagename ' ] = $ query_vars [ $ ptype_obj ->query_var ];
2159- $ query_vars ['name ' ] = '' ;
2166+ if ( is_scalar ( $ query_vars [ $ ptype_obj ->query_var ] ) ) {
2167+ $ query_vars ['pagename ' ] = $ query_vars [ $ ptype_obj ->query_var ];
2168+ }
2169+ $ query_vars ['name ' ] = '' ;
21602170 }
21612171
21622172 // Only one request for a slug is possible, this is why name & pagename are overwritten above.
You can’t perform that action at this time.
0 commit comments