Skip to content

Commit dbe5bc0

Browse files
committed
Still show custom error page if detected error cannot be persisted
Reported by @bradleyt in https://core.trac.wordpress.org/ticket/44458#comment:29
1 parent d762d2e commit dbe5bc0

1 file changed

Lines changed: 7 additions & 9 deletions

File tree

src/wp-includes/load.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1554,21 +1554,19 @@ function wp_shutdown_handler_wrapper() {
15541554
return;
15551555
}
15561556

1557-
/*
1558-
* If the option API has not been loaded yet, we cannot persist our
1559-
* discovery, so there's no point in moving forward.
1560-
*/
1561-
if ( ! function_exists( 'get_option' ) ) {
1562-
return;
1563-
}
1564-
15651557
// Bail early if this error should not be handled.
15661558
if ( ! wp_should_handle_error( $error ) ) {
15671559
return;
15681560
}
15691561

15701562
try {
1571-
wp_record_extension_error( $error );
1563+
/*
1564+
* Only try persisting the detected error if the Options API has already
1565+
* been loaded.
1566+
*/
1567+
if ( function_exists( 'get_option' ) ) {
1568+
wp_record_extension_error( $error );
1569+
}
15721570

15731571
// Load custom PHP error template, if present.
15741572
$php_error_pluggable = WP_CONTENT_DIR . '/php-error.php';

0 commit comments

Comments
 (0)