Troubleshooting · Troubleshooting
How to Fix pluggable.php Errors in WordPress
Short answer
A pluggable.php error usually means two pieces of code defined the same WordPress function twice, so PHP stops with a fatal error. Read wp-content/debug.log to find the two file paths named in the message, then deactivate or remove the plugin or theme that made the second definition. If pluggable.php itself is damaged, reinstall WordPress core from Dashboard > Updates.
Key takeaways
- A pluggable.php error is a PHP fatal error, most often a Cannot redeclare message naming two files.
- wp-includes/pluggable.php holds replaceable functions for login, cookies, nonces, and email, including wp_mail().
- Only one definition of each pluggable function is allowed in a single request.
- WP_DEBUG_LOG writes the full error, with both file paths, to wp-content/debug.log.
- Renaming a plugin folder by FTP deactivates that plugin when wp-admin will not load.
- A core reinstall replaces wp-admin and wp-includes and must keep wp-content and wp-config.php untouched.
What does a pluggable.php error mean?
A pluggable.php error means PHP stopped because the same function name was defined twice, or code called a pluggable function before WordPress loaded it.
The message often reads “Fatal error: Cannot redeclare wp_mail()” and then names pluggable.php or a plugin file. PHP cannot run two definitions of one function in the same request, so it stops and the page does not finish loading.
Visitors may see a blank page or the message “There has been a critical error on this website.” The admin may see the same screen, because login and cookie functions live in the same file. A guide on the 500 internal server error covers that generic screen in more detail.
What is wp-includes/pluggable.php and why does it exist?
wp-includes/pluggable.php is a WordPress core file that holds functions plugins and themes are allowed to replace, such as wp_mail() and login functions.
The pluggable.php file reference lists functions for users, passwords, cookies, nonces, avatars, and email. Examples include wp_get_current_user(), wp_set_auth_cookie(), wp_validate_auth_cookie(), wp_logout(), wp_create_nonce(), get_userdata(), wp_set_password(), and wp_new_user_notification().
Each function in the file is defined only if no earlier code defined it first. That check is what makes the function pluggable: a plugin can supply its own version before core runs, and core then skips its own version.
The mail function shows why this matters. wp_mail() sends an email, similar to PHP's mail function, and its default content type is text/plain. The same reference page says the function is available after the plugins_loaded hook, so code that calls it earlier can fail.
What causes a pluggable.php error?
The most likely cause is two plugins, or a plugin and a theme, trying to define the same pluggable function.
| Cause | What happens | Where to look |
|---|---|---|
| Two plugins define wp_mail() | Cannot redeclare fatal error | debug.log, both plugin paths |
| Plugin and theme define the same function | Second definition stops the request | Theme functions.php and plugin file |
| Two copies of one plugin are active | Same code loads twice | wp-content/plugins for duplicate folders |
| Custom code defines a pluggable name | A snippet claims a core name | functions.php or a code snippet plugin |
| Code calls a pluggable function too early | Function does not exist yet | Code hooked before plugins_loaded or init |
| Core file is damaged or incomplete | Error names wp-includes/pluggable.php | Dashboard > Updates, then a core reinstall |
A second copy often appears after a failed update or a ZIP upload with a different folder name. The new folder installs beside the old one, and both copies load.
Early calls are a separate cause. Developer notes on is_user_logged_in() warn that calling it too early can cause a fatal error, and they point to the init hook as the fix. The same timing rule applies to wp_create_nonce().
How do you read the full error message?
Turn on the debug log, reload the page once, then read the last fatal error lines in wp-content/debug.log.
Back up the site first, then edit wp-config.php in the site root. Add the lines above the line that says “That's all, stop editing!” A backup guide shows the two parts to save: files and the database.
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_LOG', true );
define( 'WP_DEBUG_DISPLAY', false );
Debugging in WordPress explains the three constants. WP_DEBUG is the master switch, WP_DEBUG_LOG saves errors to debug.log in wp-content, and WP_DEBUG_DISPLAY set to false keeps errors off the page. The same page says these tools are not recommended on a live site, so use a staging copy where you can.
A typical message names 4 facts: the function, the file that defined it first, that file's line, and the file where PHP stopped. In "Cannot redeclare wp_mail() (previously declared in /wp-content/plugins/plugin-a/mail.php:10) in /wp-content/plugins/plugin-b/mail.php on line 12", plugin A claimed the name first and plugin B is the duplicate to remove or fix.
How do you fix a pluggable.php error when you can still log in?
Deactivate the plugin or theme named in the error, then test the site before you change any code.
If the critical error screen appeared, check the admin email first. Recovery Mode arrived in WordPress 5.2 and sends the admin a login link when a fatal PHP error occurs during a regular page load. The faulty item is paused for your admin session only, so you can log in and deactivate it.
Follow these steps in order:
- Open the Recovery Mode link from the admin email, or log in to wp-admin as normal.
- Go to Plugins, then Installed Plugins, and deactivate the plugin named in the debug log.
- Reload the home page in a private browser window.
- If the site loads, reactivate the other plugins one at a time and reload after each one.
- If the error returns with one plugin, keep it off and check for an update or a replacement.
If the error names a theme, go to Appearance, then Themes, and switch to a default theme such as Twenty Twenty-Five. If the site loads, the old theme holds the duplicate definition.
If you added custom code just before the error, remove or revert that snippet first. Give a custom function a unique prefix, such as your site name, so it cannot claim a core name. The Plugin Handbook warns that generic names collide, and its examples use a wporg_ prefix.
How do you fix it when you are locked out of wp-admin?
Rename the suspect plugin folder by FTP or your host file manager, which deactivates that plugin without wp-admin.
Connect by FTP or open the host file manager and go to wp-content/plugins. Rename the folder named in the debug log, for example from my-mail-plugin to my-mail-plugin-off, then reload the site. WordPress treats a renamed plugin folder as inactive.
If you do not know which plugin is at fault, rename the whole plugins folder to plugins-off and reload. If the site loads, rename the folder back to plugins, then rename each plugin folder one at a time until the error returns. That last folder holds the fault.
A theme fault needs the same approach in wp-content/themes. Rename the active theme folder and WordPress falls back to a default theme. A guide on being locked out of wp-admin covers the same folder steps in more detail.
Check the Recovery Mode email again before you edit files. WordPress.org notes that the email can land in spam, or fail, when the fatal error happens before your mail plugin loads, because the message then comes direct from the server.
How do you fix a damaged or incomplete pluggable.php file?
Replace wp-admin and wp-includes with a fresh copy of the same WordPress version, and keep wp-content and wp-config.php untouched.
If you can log in, go to Dashboard, then Updates, and click Re-install now. That action downloads the current version and replaces core files without touching your content.
If you cannot log in, follow the manual route in Updating WordPress. Download the latest WordPress ZIP from wordpress.org, unpack it, delete the old wp-includes and wp-admin folders on the server, then upload the fresh folders and the new root files. Do not delete wp-content, and do not overwrite wp-config.php.
DreamHost's own reinstall guide gives the same three routes, dashboard, FTP, and WP-CLI, and states that a reinstall only replaces core files, not themes, plugins, the database, or wp-content. See the DreamHost core reinstall guide for the host-side steps.
WordPress 7.1.5 was released on November 18, 2026, as a security release, and WordPress.org notes that only the most recent version is actively supported, as of November 2026. After a repair, update to the current version if the site is behind.
A core reinstall will not fix an error that names a plugin file. If the debug log points at a plugin or theme, fix or remove that item instead of reinstalling core again.
How do you check the fix worked?
Reload the home page, log in, log out, and send a test password reset, then check that no new fatal error appears in the log.
Use this short check list after each fix:
- The home page loads without a critical error screen.
- You can log in to wp-admin and open Plugins and Appearance.
- You can log out and log back in, which uses the cookie functions in pluggable.php.
- A password reset email arrives, which uses wp_mail().
- The last lines of wp-content/debug.log show no new fatal error after you reload the page.
Turn debug logging off when the checks pass. Set WP_DEBUG back to false in wp-config.php and delete wp-content/debug.log, because the log can list file paths. Then reload the site once more to confirm it still works with logging off.
When should you contact your host?
Contact your host when the error stays after you removed the suspect plugin and theme, or when you cannot reach files, logs, or the PHP version setting.
Ask the host for the server error log when wp-content/debug.log is empty or missing. The server log can show the same fatal error even when WordPress logging never started.
Ask about the PHP version when the error followed a PHP change. WordPress.org recommends PHP 8.3 or greater, as of November 2026, with MariaDB 10.11 or greater or MySQL 8.4 or greater, and HTTPS support.
The project also notes that WordPress still runs on PHP 7.4 and MySQL 5.5.5, but those versions have reached end of life and may expose the site to security problems.
PHP dates add weight to that question. The PHP supported versions page lists security fixes for PHP 8.2 until December 31, 2026, for PHP 8.3 until December 31, 2027, and for PHP 8.4 until December 31, 2028.
A PHP version update guide covers the safe order: back up, check plugin support, change the version, then test.
Contact the host at once if core files keep changing, if files appear that you did not add, or if the error returns minutes after a clean reinstall. Those signs point to a server or security problem, not a single plugin clash.
What mistakes should you avoid?
Do not edit wp-includes/pluggable.php to remove the error, because the next WordPress update overwrites the file and the duplicate definition stays.
Do not delete wp-content or wp-config.php during a core reinstall. The first holds themes, plugins, and uploads, and the second holds the database connection details.
Do not leave WP_DEBUG_DISPLAY set to true on a live site. Visitors would see file paths and error text that belong in a log.
Do not activate two mail plugins that both replace wp_mail(), and do not keep two copies of one plugin in wp-content/plugins. One definition wins, and the second one stops the site.
Do not wrap every custom function in a function_exists() check as a substitute for a unique name. A guard can hide a clash and let the wrong version run, so rename the function with a distinct prefix first.
Frequently asked questions
Can I just delete pluggable.php to stop the error?
No. The file holds login, cookie, nonce, and email functions that WordPress needs on almost every page. Deleting it breaks the site more than the error does. Fix the duplicate definition in the plugin or theme, or replace the file with a fresh copy from the same WordPress version.
Why does the error appear only after I activate a plugin?
Activation loads the new plugin code, and that code may define a function that another plugin or the theme already defined. WordPress loads plugins before it defines pluggable functions, so the clash only shows when both pieces of code run in the same request. Deactivate the last plugin you added and test again.
Is a pluggable.php error the same as a headers already sent error?
No, but the two can appear together. A Cannot redeclare error means a function name was defined twice. A headers already sent error means output, such as stray whitespace before a PHP tag, reached the browser before WordPress sent headers. Read the first fatal error line in the debug log, because that line names the real cause.
Will reinstalling WordPress delete my posts and settings?
No, if you follow the core reinstall route. Reinstalling core replaces wp-admin and wp-includes and the root core files, while wp-content and wp-config.php stay in place. Your posts live in the database, and your themes, plugins, and uploads live in wp-content. Back up files and the database first, in case a step goes wrong.
How do I stop this error from coming back?
Keep one copy of each plugin, update plugins and themes before you add new code, and test changes on a staging copy first. Give custom functions a unique prefix, avoid two plugins that both replace the same mail or login function, and keep WordPress and PHP on supported versions.
Sources
- wp-includes/pluggable.php WordPress Developer Resources
- wp_mail() WordPress Developer Resources
- Debugging in WordPress WordPress.org
- Recovery Mode WordPress.org
- Requirements WordPress.org
- Updating WordPress WordPress.org
- Supported Versions PHP Group
- pluggable.php source on GitHub WordPress
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
