| @@ -100,10 +100,10 @@ | ||
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | # Parse saved domain + incoming URL |
| 104 | - $saved_domain = parse_url($saved['domain'], PHP_URL_HOST); | |
| 105 | - $incoming_domain = parse_url($url, PHP_URL_HOST); | |
| 104 | + $saved_domain = wp_parse_url($saved['domain'], PHP_URL_HOST); | |
| 105 | + $incoming_domain = wp_parse_url($url, PHP_URL_HOST); | |
| 106 | 106 | |
| 107 | 107 | # Domain mismatch - not crawled |
| 108 | 108 | if (empty($saved_domain) || empty($incoming_domain) || strcasecmp($saved_domain, $incoming_domain) !== 0) { |
| 109 | 109 | return false; |
| @@ -109,9 +109,9 @@ | ||
| 109 | 109 | return false; |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | 112 | # Parse incoming path (ignore query string) |
| 113 | - $parsed_url = parse_url($url); | |
| 113 | + $parsed_url = wp_parse_url($url); | |
| 114 | 114 | $url_path = $parsed_url['path'] ?? '/'; |
| 115 | 115 | |
| 116 | 116 | # Ensure path starts with / but don't modify trailing slashes |
| 117 | 117 | # Otto stores paths exactly as they appear in URLs |
| @@ -198,9 +198,16 @@ | ||
| 198 | 198 | function render_route_html(){ |
| 199 | 199 | |
| 200 | 200 | # Headless frontends do not consume WordPress-rendered HTML, so avoid |
| 201 | 201 | # suggestion lookups, buffering and internal fetches altogether. |
| 202 | - if (Metasync_Headless_Config::is_active()) { | |
| 202 | + # Falls back to a guarded direct read rather than skipping the check: | |
| 203 | + # silently skipping would render OTTO markup on a headless site. | |
| 204 | + # @phpstan-ignore-next-line function.alreadyNarrowedType | |
| 205 | + $headless = function_exists('metasync_headless_is_active') | |
| 206 | + ? metasync_headless_is_active() | |
| 207 | + : (class_exists('Metasync_Headless_Config') && Metasync_Headless_Config::is_active()); | |
| 208 | + | |
| 209 | + if ($headless) { | |
| 203 | 210 | return; |
| 204 | 211 | } |
| 205 | 212 | |
| 206 | 213 | # Clear per-request statics before any path runs. Harmless under PHP-FPM |