Tipps

How To Fix The WordPress Error „The plugin does not have a valid header“

If you try to install a WordPress plugin and see the message „The plugin does not have a valid header“ there might be an easy solution how to fix it.

Photo by transitpeople

I recently came across that error when trying to install and activate a plugin on my self-hosted WordPress sites. The message simply said: „The plugin does not have a valid header“ Unfortunately, it was not really helpful to debug the problem. What made it even more mystifying was the fact that the plugin could still be activated from the list of plugins, but not directly after installation.

This problem is often caused by a wrong folder structure in the plugin – for example if the plugin’s main file is placed in a second level under the „wp-content/plugins/“ directory:

wp-content/plugins/my-plugin/my-plugin/ (files here)

In that case it helps to move everything up by one level:

wp-content/plugins/my-plugin/ (files here)

That, however, was not the case here. After some searching I found that the headers of some PHP files hidden in the sub-folders of the plugin looked similar to the mandatory header of plugin main files:

/*
Plugin Name: ...
Plugin URI: ...
Author: ...
...

WordPress seemed to assume that one of those files was the actual main plugin file.

I fixed the issue by going through all files and changing the format of the headers to something that wouldn’t confuse the installer. Afterwards, the installation needed to be repeated from the start with the correct files.

Photo by transitpeople

Check Out My Plugins:

Organize your tags in coherent groups and tidy up your tag cloud! Display your tags under tabs or in an accordion.

You will never want to go back to the times when your tags were all over the place.

FREE

Supercharge your tags! Tag your posts on two levels with tag groups. Filter your posts on the frontend. Let your visitors search in real time by tags and groups.

Go directly to your first, latest or a random post just by adding some magic words to your site's URL. Search posts by author, or category, or something else. Or combine a time frame with search parameters.

FREE

Comments are closed.