How to make a plugin

Disable plugins and themes update notification

So I have just drafted my first plugin. Actually it is really easy. All I had to do, was create a directory with the plugin name in my /wp-content/plugins/ directory. My new directory /wp-content/plugins/disable_plugins_themes_update_notification only contains one file disable_plugins_themes_notifications.php. The name of the main .php file should be the same as the name of the directory it is in. WordPress finds it automatically.

The plugin hooks into two actions:

  • auto_theme_update_send_email
  • auto_plugin_update_send_email

and sets them to false by the built in function

  • __return_false.

The code is:

// Disable auto-update email notifications for plugins.
add_filter( 'auto_plugin_update_send_email', '__return_false' );
 
// Disable auto-update email notifications for themes.
add_filter( 'auto_theme_update_send_email', '__return_false' );

More info about WP’s hooks can be found in this Kinsta’s comprehensive article.