Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete plugin translation files when plugin is uninstalled #339

Conversation

agrullon95
Copy link
Contributor

Summary

Currently, plugin translation files are not deleted from /wp-content/languages/plugins when a plugin is uninstalled using wp-cli.
With these changes, file translation files will also be deleted when a plugin is uninstalled.

Testing instructions

  1. Install a plugin using the following command: wp plugin install [PLUGIN-NAME]
  2. Install translation files for the plugin you installed: wp language plugin install [PLUGIN-NAME] [language]

Example:

wp plugin install duplicator.
wp language plugin install duplicator fr_FR.

Access /wp-content/languages/plugins and verify you see the language files for the plugin you installed.

duplicator-fr_FR.mo
duplicator-fr_FR.po

  1. Uninstall the plugin using wp plugin uninstall [PLUGIN-NAME].
  2. Verify the language files no longer exist in the plugins folder.

Fixes #337

@agrullon95 agrullon95 requested a review from a team as a code owner November 10, 2022 00:02
Copy link
Member

@danielbachhuber danielbachhuber left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your work on this, @agrullon95 !

I made one tweak to your conditional so uninstall_plugin( $plugin->file ); is always called. There was a failure otherwise.

I also added a feature test, if you want to take a look at that.

@danielbachhuber danielbachhuber merged commit 98fbf53 into wp-cli:master Nov 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Uninstalling a plugin does not remove plugin language files
2 participants