Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions src/Router/RewriteHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down