I was working on my website this morning and discovered that I was getting an error on a security scan of my website for a plugin that I have installed elsewhere and trust highly (Cloudflare). Looking into the error message a bit made me think that I should just uninstall and reinstall the plugin. I gave that a shot and interestingly enough, I found that I got an error message while removing the plugin. While it wasn’t Hello Dolly, it the error message looked like this.

Deletion failed: {“success”:true,”data”:{“delete”:”plugin”,”slug”:”hello-dolly”,”plugin”:”hello-dolly\/hello.php”,”pluginName”:”Hello Dolly”}}

deletionfailed

When I tried to reinstall the plugin, I got a similar message.

Installation failed: {“success”:true,”data”:{“install”:”plugin”,”slug”:”hello-dolly”,”pluginName”:”Hello Dolly”,”activateUrl”:”http:\/\/www.isanadventure.com\/wp-admin\/plugins.php?_wpnonce=0a78f22283&action=activate&plugin=hello-dolly\/hello.php”}}

installationfailed

At this point, I tried to just activate the plugin and I wound up with a blank page with the following errors

Warning: Cannot modify header information – headers already sent by (output started at /home/domain.com/domain.com/wp-content/themes/ThemeWP/functions.php:5) in /home/domain.com/domain.com/wp-includes/pluggable.php on line 1174

Warning: Cannot modify header information – headers already sent by (output started at /home/domain.com/domain.com/wp-content/themes/ThemeWP/functions.php:5) in /home/domain.com/domain.com/wp-includes/pluggable.php on line 1174

So after poking around at things for about an hour I found what appears to be the solution for most of the Installation Failed or Deletion Failed errors in WordPress with both themes and plugins.

I looked at the Child Theme I was using, which in my case had a single file (functions.php) and found that somehow I had added an extra line to it, which broke things.

<?php // Your php code goes here ?>

~

Note the space after the ?> and before the ~

I edited the file and deleted that line so it looks like

<?php // Your php code goes here ?>
~

And that was that! Everything worked fine after that including some issues I had with the dynamic search results on the plugins page which had been giving me nothing but a spinning circle every time I typed something in the search box. Hope that helps someone else.