Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#51556 closed defect (bug) (invalid)

Cannot activate a plugin which overrides pluggable function

Reported by: superpoincare's profile superpoincare Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Plugins Keywords:
Focuses: administration Cc:


Trying to activate a plugin with a function with the same name as in wp-includes/pluggable.php gives a fatal error and doesn't activate it.

This probably happens because during the activation process, the pluggable.php file loads earlier. In a normal loading process, the plugin would load earlier and not give this error.

The same plugin would however activate without any errors if I remove the lines and activate the plugin. The plugin would also run if the lines are added after the activation, either by FTP or using the code editor.

Change History (4)

#1 @garrett-eclipse
4 years ago

  • Keywords close added

Hello @superpoincare with your function are you wrapping it in a function_exists? When overriding pluggable functions it's recommended to do so to avoid the fatal you're running into.

For safety, it is best to always wrap your functions with if ( !function_exists() ), otherwise you will produce fatal errors on plugin activation.


I hope that helps overcome the issue, marking as close as this is expected behaviour but leaving open for now incase I misunderstood.

#2 @superpoincare
4 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Yes, it works that way, I forgot to mention.

Didn't know it was the expected behaviour.

Closing myself.

#3 @garrett-eclipse
4 years ago

Awesome, thanks for following up @superpoincare

#4 @garrett-eclipse
4 years ago

  • Keywords close removed
  • Milestone Awaiting Review deleted
  • Version 5.5.1 deleted
Note: See TracTickets for help on using tickets.