Fatal error: Cannot redeclare …() (previously declared in …)
“Cannot redeclare …() (previously declared in …)” in WordPress: causes and what to check
# Common log entries
PHP Fatal error: Cannot redeclare …() (previously declared in /wp-content/plugins/…)
PHP stops with this error when the same function name is declared twice. In WordPress it usually means two plugins, or a plugin and the theme, ship a function with the same name, or the same file is loaded twice. PHP 8.4 words it as “Cannot redeclare function …()”.
Which of these do you see?
The new plugin declares a function that another plugin or the theme already declares. The message names both files.
The snippet defines a function that already exists, often because it was pasted twice.
A plugin folder was copied or renamed, and both copies are active.
Common causes
References
Rather not fix it yourself? Let WP119 handle it automatically.
White screens and fatal errors (plugin conflicts, PHP version incompatibility) are handled automatically: on a copy of your site in the recovery station, the system turns on debug mode, finds the plugin or theme causing the error and deactivates it (not deleted); a white screen caused by exhausted memory is fixed by raising the memory limit. After the fix, the home page and inner pages are re-verified, and only then is the result written back to your host (in WP admin mode, a recovered package is delivered instead). Fixes are made on a copy of your site in the recovery station and written back only after re-verification passes. In your site’s database, the protected tables (members, comments, orders and form submissions) are copied as structure only. In SSH and FTP mode, the system creates a pre-recovery backup on your host before writing back and restores from it if verification after write-back fails. If the recovery cannot be completed, the recovery fee is refunded in full.
- Initial assessment: Site URL entry
- Copy to the recovery station: Work on a copy
- Diagnosis: Item-by-item checks
- Recovery and verification: Home and inner pages
- Write-back or delivery: Only after verification passes
Use WP119 when this error stops the site or the admin area from loading.
Check my site →