WordPress: How to rename the main php plugin base file?

There is no safe reliable way to do this, wether it is or is not on wordpress.org, and .org may get upset if you do this. You might also break automations on .org and on your customers sites.

Is there a way to specify the new base name for a plugin so that I can rename my main php file?

No there is no mechanism for this.


There is an ultra hacky workaround that will p*ss off all your users, break lots of things, but do the job for a minority of users who update regularly and are lucky.

The only “way” to do it would be to introduce a version of the plugin that has 2 main plugin files, and a filter to transfer from one to the other.

However:

  • users will see 2 plugins listed when on this version
  • users who don’t update to this version or update to the next version will not be migrated
  • security plugins may see this as an attack
  • users may then reactivate the old plugin
  • any filters users have made to auto-activate the plugin will be crippled, you will have broken their website
  • any users who put your plugin in a non-standard place then include it with an include or require will have their sites broken
  • the built in updater may upgrade the old plugin file to the newer version that has only your new basefile, get confused, and deactivate the plugin, or rollback the update assuming it had failed
  • in theory your new base file is actually a brand new plugin, there may be consequences in terms of your plugins listing and how the WP updater handles it

The cost to doing this is extremely high, with a minimal chance of success, all to satisfy a personal preference. Expect lots of upset users and support burden.

tech