Skip to content

SiteRepairManual

WordPress repairs run on a throwaway install before they are written down.

Fix a parse error after editing functions.php

Checked 11 November 2026 · WordPress 7.1.4 · PHP 8.3.6 · MariaDB 10.11.14 · WP-CLI · Read time: 5 minutes

Case file

Symptom
Critical error page on every page, including wp-admin, HTTP 500
Cause
An unclosed brace left in the theme’s functions.php by an edit
Fix
Restore functions.php from backup, or remove the bad edit
Result
The homepage and wp-admin return HTTP 200 again

The break · What you need · The diagnosis · The fix · Verify · If that didn’t work · What happened · Where this came from

The break

functions.php loads on every page of a WordPress site, so a syntax mistake in it takes down the whole site at once — homepage, posts, and wp-admin together. The official list of common errors puts it plainly: a syntax error means a mistake in the PHP structure, such as a missing curly bracket, and the error will tell you which file it appears in (functions.php, for example) and approximately which line.

This guide reproduces the break first. A disposable install ran the Twenty Twenty-Five theme, and a test edit left a function without its closing brace in functions.php — the classic end-of-edit mistake. The homepage and wp-admin both went from HTTP 200 to HTTP 500, and the log named the file and the line.

What you need

The diagnosis

1. Confirm the symptom

Load the homepage and wp-admin and note the status codes. In the reproduction, the healthy site returned HTTP 200 on both. With the broken edit in place, both returned HTTP 500 with the critical error page:

Output — homepage with the broken edit

HTTP 500
<title>WordPress &rsaquo; Error</title>
There has been a critical error on this website.

Key result: wp-admin failing the same way as the homepage points at something that loads everywhere — a theme file, not a single post or page. That is the signature of functions.php.

2. Read the parse error in debug.log

Turn on WP_DEBUG and WP_DEBUG_LOG as described in the white screen guide, load the homepage once so the error is written, and read wp-content/debug.log:

Output — wp-content/debug.log

[11-Nov-2026 16:12:20 UTC] PHP Parse error:  Unclosed '{' on line 162
in .../wp-content/themes/twentytwentyfive/functions.php on line 164

The message names the file and two lines: the unclosed brace is on line 162, and PHP only noticed at line 164, the end of the file. The official common-errors guide warns the line may not be the exact one — check just before and just after it. The usual suspects are a missing curly bracket, a missing semicolon at the end of a line, or a missing quotation mark, all listed in that guide.

Key result: the log gives the file and the line. That is enough to fix it — the edit introduced the mistake, so the fix is in that file, near that line.

The fix

3. Remove the bad edit

Open wp-content/themes/twentytwentyfive/functions.php in your file manager or over SFTP and undo what you just changed — restore the file from your backup, or delete the lines you added. In the reproduction the file was restored from a backup copy and the homepage returned HTTP 200 immediately:

Output — homepage after restoring functions.php

HTTP 200
<title>SRM Test</title>

Trap: do not try to fix this from the WordPress dashboard. wp-admin returns the same HTTP 500, so the Theme File Editor is unreachable. The fix is a file edit outside WordPress.

Verify the site is back

Load the homepage and wp-admin again and check both status codes. In the reproduction both returned HTTP 200 after the file was restored, with the theme untouched otherwise.

StepHomepage statuswp-admin status
Healthy siteHTTP 200HTTP 200
Unclosed brace in functions.phpHTTP 500 — critical error pageHTTP 500 — critical error page
After restoring the fileHTTP 200HTTP 200

If that didn’t work

Rename the theme folder to get the site back first

If you cannot find the bad line, or you have no backup and need the site up now, rename the theme folder in wp-content/themes — in the reproduction, renaming twentytwentyfive to twentytwentyfive-off returned the homepage to HTTP 200 at once, because WordPress stops loading the broken theme. Rename the folder back once the file is fixed, and the theme picks up where it left off. This is the same recovery the official common-errors guide gives for a theme-caused white screen: rename the active theme’s folder over FTP.

If the error names a different file

The same steps work wherever the parse error lives — a plugin file, a child theme, or wp-config.php itself. The log names the file; fix that file. If the log names wp-config.php, the site cannot load at all, and the recovery is the same: restore the file from backup over SFTP.

What happened

An edit left a function without its closing brace in functions.php, so PHP could not parse the theme file and every page returned HTTP 500. The debug log named the file and the line, the file was restored from backup, and the homepage and wp-admin returned HTTP 200.

Where this came from