Removing customise fields during plugin uninstallation

I created a plugin that insert a field on the customise theme options. Since I use

add_action( 'customize_register', 'myregister' );

to create the customise, should I use

Read More
 remove_action( 'customize_register', 'myregister' );

when the plugin is deactivated or uninstalled?

Related posts

1 comment

  1. The Plugin API has hooks for that:

    You can use register_deactivation_hook to run a function when the plugin is deactivated.

    For uninstall, you have two options. Either register_uninstall_hook or add a file called uninstall.php in your plugin folder.

    I would not recommend delete plugin options on plugin deactivation though, the user might not know that he is losing his saved data.

Comments are closed.