PHP, the language WordPress is written in, reads a whole file before it runs any of it. One wrong character - a missing semicolon, an extra brace, a curly quote pasted from a blog - and it refuses the entire file. If that file is your theme's functions.php, wp-config.php or an active plugin, every page and the admin go down together. The good news: the message names the exact file and line, and nothing in your content is lost. Below is a rebuilt example (not a real client), how to read the message, and the fix for each cause.
Parse error: syntax error, unexpected ... in /home/.../functions.php on line 42 - or WordPress's own "There has been a critical error on this website" page. In the second case the full line is in your host's error log (cPanel: Metrics > Errors, or error_log in the site's folder), and the site's admin email usually has a message titled "Your Site is Experiencing a Technical Issue" that names it too.wp-content/themes/... is the theme, wp-content/plugins/name/... is that plugin, wp-config.php is the site's settings file. The line number is where PHP gave up, so the mistake is on that line or just above it - a missing ; or ) at the end of the previous line is reported on the next one.;, or better, through the free Code Snippets plugin, which checks the code before it runs and switches off a snippet that breaks.<?php or some HTML pasted inside PHP. The message says unexpected '<' or unexpected token "<". A snippet that starts with <?php was pasted into a file that is already PHP. Delete the extra opening tag.unexpected '?', unexpected '=>' or unexpected '|'. The plugin is written for PHP 8 and the host still runs 7.x. Rename the plugin's folder in wp-content/plugins to switch it off, then either move the site's PHP version up in the host panel (after a backup, and after checking your other plugins support it) or install the plugin version that matches your PHP.unexpected end of file in a plugin or theme file nobody edited usually means an FTP upload or an update was cut off. Delete that plugin's folder and install a fresh copy; your settings live in the database and stay.wp-config.php. Adding a line such as a memory limit or debug setting with a curly quote or no semicolon takes the whole site down, including the recovery email. Restore the copy, or retype the new line with straight quotes and a ; at the end.| What the message says | Usual cause | Usual fix |
|---|---|---|
unexpected identifier or unexpected variable at the start of a line | Missing ; or ) at the end of the line before | Add it on the previous line |
unexpected identifier next to words in quotes, or a curly quote in the message | Curly quotes from a blog or a document | Retype the quotes as straight ' or " |
unexpected '}' or unexpected end of file in a file you edited | A brace missing or one too many | Remove the pasted block, or match every { with a } |
unexpected '<' | A second <?php or HTML inside PHP | Delete the extra opening tag |
unexpected '?', '=>' or '|' inside a plugin you just updated | Plugin needs a newer PHP | Rename its folder; raise PHP or use the matching version |
unexpected end of file in a file nobody touched | Upload or update cut off | Fresh copy of that plugin or theme |
functions.php to make the error go away. The theme needs the rest of that file; remove only what was added.functions.php at all. The next theme update wipes them out. Use a child theme or a snippets plugin.Once you have the file and the line, the fix is usually one character or one pasted block. If you would rather hand it over, or you cannot get into the host's file manager, that is what the box below is for. Related: "There has been a critical error", a blank white screen, 500 Internal Server Error and a plugin conflict.