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”}}
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”}}
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.
Awesome!!! Fixed the problem, thanks 🙂 🙂 🙂
Sweet! I’m glad this finally helped someone. 🙂
I’m having this exact problem but wondering where to head to to fix this code? Was it in the header, main index etc?
Appreciate any help, thank you!
Kevin,
It is in the functions.php file inside your theme or child theme.
Thank you so much. You were very helpful.
Happy to have helped!
Thank you, thank you, thank you so much! This neatly solved my problem.
So simple … thank you
solved my problem as well
I have to thank for this post… Same as yours I had accedentally added an extra line at the end of my child themes funtions.php 🙁 You saved my day! Thanks
Pleased to have been of service. 🙂
In my case, it was because I accidentally allowed a 301 redirect to the wp-admin/ajax.php which redirected to the home page. That meant anything using the ajax file was being redirected!
You are a beautiful human being. Thank you so much for sharing. x
It didn’t work for me sir what else could be wrong here
Thanks for tip where to search 🙂
In my case it was BOM signature in functions.php in child theme.
Awesome! Simple and helpful solution.
Just delete blank line on my functions.php and it works. I have no idea..how it works
Great, just solved my 2 days problem, the wp site was showing blackscreen when refered from google search. found a huge chunk of codes in the functions.php. Thanks very much.
Very happy to have been of service. 🙂
I can’t find it on fuction.php
please help
functions.php is the file you’re looking for and it would be in your Child theme or theme located in wp-content/themes/
Thank you, I got just a space in before php and some problems with update plugins. Now everything working fine.
Thank you very much, i replaced the edited functions.php with default functions.php file . its stated working.