diff --git a/src/Router/RewriteHandler.php b/src/Router/RewriteHandler.php index e7220a1..fe58fad 100644 --- a/src/Router/RewriteHandler.php +++ b/src/Router/RewriteHandler.php @@ -247,11 +247,19 @@ public function handle_format_parameter(): void { return; } - if (!is_singular()) { - return; - } + $post = null; - $post = get_queried_object(); + if (is_singular()) { + $post = get_queried_object(); + } elseif ('page' === get_option('show_on_front') && (is_front_page() || is_home())) { + // Static front page: the extra ?format= query var can prevent + // WordPress from recognising the request as singular, so it falls + // back to the blog-post index. + $page_on_front = (int) get_option('page_on_front'); + if ($page_on_front) { + $post = get_post($page_on_front); + } + } if (!$post instanceof WP_Post) { return;