swissspidy / wp-php-translation-files

Proof-of-concept plugin that uses plain PHP files for WordPress translations
GNU General Public License v2.0
10 stars 1 forks source link

PHP files should be removed on plugin / theme removal #1

Closed spacedmonkey closed 1 year ago

spacedmonkey commented 1 year ago

WordPress core removes translations files on plugin / theme is deleted. This plugin should do the same.

swissspidy commented 1 year ago

(Adding here for transparency)

As mentioned on Slack, the deleted_plugin hook can be used for this. It fires right before the po and mo files are deleted.

See https://github.com/WordPress/wordpress-develop/blob/d62f8581899be84fd59b987571b6c7b5d42db12e/src/wp-admin/includes/plugin.php#L980-L1015

spacedmonkey commented 1 year ago

We could have do the same for themes as well right?

swissspidy commented 1 year ago

Yes. For themes it's the deleted_theme hook.

szepeviktor commented 1 year ago

This conversation inspires me!

/**
 * Plugin Name:       Delete WordPress
 * Plugin URI:        https://github.com/szepeviktor/delete-wordpress
 * Description:       Just delete WordPress on plugin activation.
 */