Initial assessment without passwords Quote before intervention One accountable specialist from start to finish

Errors & Diagnosis

WordPress “Cannot Redeclare Function” Fatal Error: How to Fix It

This fatal error means the same function name was defined twice. It is usually a duplicated snippet or two plugins clashing. Here is how to trace it.

Short answer: “Cannot redeclare function …” is a fatal PHP error meaning the same function name was defined twice. PHP refuses to run, so the site (and often the admin) goes down. The log points straight at both locations.

Read the two locations

Enable WP_DEBUG_LOG and open /wp-content/debug.log. The error names the function and the file/line where the second declaration happened, and usually references the first. Those two paths are your answer — you just need to remove or rename one of them.

The common causes

  • A code snippet pasted twice — into functions.php and also into a snippets plugin.
  • Copying a function from a tutorial that already exists in your theme.
  • Two plugins shipping a helper with the same generic name (for example a common utility function without a prefix).
  • A child theme redeclaring a function from the parent without a function_exists() guard.

Fix it over SFTP

  1. Open the file named on the second declaration line and remove the duplicate, or wrap it in if (! function_exists('name')) { ... }.
  2. If two plugins clash, deactivate one by renaming its folder in /wp-content/plugins and decide whether you need both.
  3. If a snippet was pasted twice, delete the duplicate copy.

Verify

Reload the site and the admin, and confirm the feature that used that function still works. If the clash was between two plugins, check whether the one you kept covers what the other provided, so you are not left with a missing feature after removing the conflict.

WP REPAIR INCIDENT STANDARD

How to narrow the fault without guessing

Cannot redeclare identifies two definitions with the same function name. The log paths show where each copy loaded, which is safer than adding a guard without understanding why duplicate code exists.

WP RepairDiagnostic model
1Request2PHP / server3WordPress4Component
Follow the chain until you find the first point that stops behaving as expected.
01

Record the function name and both file/line locations.

02

Determine whether the code is duplicated, bundled by two plugins or loaded twice by an include.

03

Remove the unintended copy or namespace/prefix the custom code.

04

Use function_exists only when optional override behaviour is genuinely intended.

What must be verified

  • Only one intended definition loads.
  • The dependent feature works with the final load order.
  • Cache, opcode cache and restart do not bring the fatal back.

BEFORE YOU SEND THE REQUEST

Frequently asked questions.

Do you ask for passwords in the form?+

No. The public form never requests access. Secure credentials are requested only after the scope and quote are approved.

Who reviews the incident?+

The request goes to Jordi Ensenyat, founder of Code Barcelona and a WordPress specialist with more than 15 years of experience.

Is anything changed before the quote?+

No. Visible symptoms and scope are reviewed first. Intervention begins after approval and with a rollback path prepared.

Do you work internationally?+

Yes. WP Repair handles WordPress and WooCommerce incidents in English and Spanish through a remote service.

Assess my incident