What this problem looks like
Unlike vague critical errors, parse errors name the exact file and line. Common causes include a missing semicolon, unclosed bracket, pasted code outside PHP tags, or a bad edit to functions.php from the theme customiser.
You do not need wp-admin to fix this. Open the file via SFTP, correct or remove the bad code, and reload the site.
Step 1: Decode the error message
A typical message looks like: Parse error: syntax error, unexpected end of file in /home/user/public_html/wp-content/themes/mytheme/functions.php on line 42. The path and line number are your map.
- functions.php in your theme: undo recent custom code.
- wp-content/plugins/code-snippets/: deactivate the snippet plugin via FTP.
- mu-plugins/: remove the offending must-use plugin file.
Step 2: Fix functions.php safely
Open wp-content/themes/your-theme/functions.php. Go to the line in the error. Look for unclosed {, (, or missing ;. If you are unsure, comment out the recent block by wrapping it:
/*
Your recent custom code here
*/
Step 3: Deactivate snippet and custom code plugins
If the path is inside wp-content/plugins/, rename that plugin folder to .off. Code Snippets, Insert Headers and Footers, and WPCode are frequent sources of parse errors after quick edits.
Step 4: Restore the original file
Download a fresh copy of the theme or plugin from the vendor ZIP and replace only the broken PHP file. Do not overwrite wp-config.php or uploads.
Step 5: Validate PHP before saving next time
On SSH, run php -l against a file before upload:
php -l wp-content/themes/mytheme/functions.php
When to stop DIY and hire help
If the parse error points at WordPress core files you did not edit, files may be corrupted or infected. BugShield fixes syntax and core corruption at a fixed price with malware checks included when needed.