• Software by
  • Christoph Amthor
Search Menu

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

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

  • 3
Updated: 2018-07-27T07:18:33+00:00

1 Comment Write a comment

  1. Indeed this was actually what happened to my plugin, I had to remove the individual headers from the files. Thank you.


Leave a Comment

Required fields are marked *.