From fac797105f55d353437317ee02500e474d73b453 Mon Sep 17 00:00:00 2001 From: Giovanni Cascione <43221199+spleen1981@users.noreply.github.com> Date: Wed, 20 Jul 2022 00:16:56 +0200 Subject: [PATCH] Slugs: handle custom query var as array (#1200) --- modules/slugs/qtx_module_slugs.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/slugs/qtx_module_slugs.php b/modules/slugs/qtx_module_slugs.php index 55865035..3d28e2dd 100644 --- a/modules/slugs/qtx_module_slugs.php +++ b/modules/slugs/qtx_module_slugs.php @@ -973,6 +973,11 @@ private function get_last_slash( $slug ) { private function get_page_id_by_path( $page_path, $post_type = 'page' ) { global $wpdb; + // Handle cases where custom query vars with the same names of specific internal query vars (e.g. 'name') are structured as arrays for any reason. + if ( ! is_scalar( $page_path ) ) { + return null; + } + $page_path = rawurlencode( urldecode( $page_path ) ); $page_path = str_replace( '%2F', '/', $page_path ); $page_path = str_replace( '%20', ' ', $page_path );