Guides › WordPress › Site down or error screens

WordPress 'Parse error: syntax error, unexpected' After Editing Code

A typo in a PHP file breaks the site. Find the line the error names and fix or undo the change.

Reference guide. This guide is written from established practice and the official documentation of the tools involved. We have not yet tested every step on a live demo site. Back up your site before you change anything.

A parse error means PHP could not read the file because of a typing mistake. The message tells you the file and line.

Step 1: Read the message

For example "syntax error, unexpected '}' in /wp-content/themes/mytheme/functions.php on line 52". The mistake is on that line, or just above it.

Step 2: Undo the last change

The fastest fix is to remove what you just added, or restore the old version of the file from a backup. Edit through File Manager or FTP, since the dashboard is not available.

Step 3: Common mistakes

Step 4: Prevent it

Add custom code with a code-snippets plugin, which checks the code and disables it if there is an error, or use a child theme. See our theme guide.

Related

For a generic crash message, see our critical error guide.

Related guides

Did this solve it? If not, email hello@sitefixlab.org with the exact error text and we will look into it. Try the problem finder.

Last updated 2026-11-21.