At some point when zipping my-plugin.zip I gave it an incorrect name and installed it, causing my-plugin to fail when opening its admin menus etc.

I then fixed the zip name, and attempted to install my-plugin.zip. WordPress says it installed the plugin and I try to activate it, I get the warning

Warning: require(/var/www/html/site/public_html/wp-content/plugins/my-plugin-1/includes/class-my-plugin.php): failed to open stream: No such file or directory in /var/www/html/site/public_html/wp-content/plugins/my-plugin-1/my-plugin.php on line 1312

It seems to now be looking in my-plugin-1 instead of my-plugin ... I ensured both my-plugin and my-plugin-1 folders do not exist in wp-content/plugins before installing the plugin - But the issue persists - Any ideas?

  • the folder name of your plugin shouldn't be an issue, you should be able to give it any name and activate it, and it would still work. Are you hardcoding the plugin folder name in your PHP code? Did you delete the previous plugin you uploaded? I notice there is no code to debug in your question – Tom J Nowell Apr 6 at 13:52
  • The plugin folder is not hardcoded at line 1312. require plugin_dir_path( __FILE__ ) . 'includes/class-my-plugin.php'; Looking at server file system, it is definitely creating the my-plugin-1 folder even despite my-plugin not existing... However the owner of the folder is different to other plugins for some reason... – Thomas Harris Apr 6 at 14:47
  • Which version of WordPress are you using? And did you delete the plugin before re-uploading it? And have you confirmed that your zip file contains the correct version of the code? Have you considered using FTP to upload it instead? – Tom J Nowell Apr 6 at 14:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.