How to set plugin auto-update Enabled by default?
I have the following problem. I have created a plugin for Wordpress. In the first versions of the plugin I forced users to auto update using this function:
function my_plugin_auto_update ( $update, $item ) {
$plugins = array ( 'my_plugin' );
if ( in_array( $item-slug, $plugins ) ) {
// update plugin
return true
} else {
// use default settings
return $update;
}
}
add_filter( 'auto_update_plugin', 'my_plugin_auto_update ', 10, 2 );
The user had no way to disable auto-update.
Currently the plugin is already stable and I don't want to force users to auto-update anymore. When I remove the above function, the user can enable/disable auto-update from the Plugins tab. However by default this auto-update is disabled. How to make that after installing new version of my plugin auto-update is enabled by default but also user could disable it?
Topic plugin-development automatic-updates plugins Wordpress
Category Web