auto_update_<type>

Filters whether to automatically update core, a plugin, a theme, or a language.

Description

apply_filters( 'auto_update_<type>', (bool) $update, (object) $item ); 

The dynamic portion(s) of the hook name refer to the type of update being checked. Can be core,, theme., plugin, or translation.

Generally speaking, plugins, themes, and major core versions are not updated by default, while translations and minor and development versions for core are updated by default.

See the , and filters for a more straightforward way to adjust core updates.

Parameters (2)

0. $update (bool)
Whether to update.
1. $item (object)
The update offer.

Usage

To run the hook, copy the example below.
  1. $update = apply_filters( 'auto_update_{$type}', $update, $item ); 
  2.  
  3. if ( !empty( $update ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the auto_update_<type> callback 
  2. function filter_auto_update_type( $update, $item ) { 
  3. // make filter magic happen here... 
  4. return $update
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( "auto_update_{$type}", 'filter_auto_update_type', 10, 2 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( "auto_update_{$type}", 'filter_auto_update_type', 10, 2 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-admin/includes/class-wp-automatic-updater.php  
  1. $update = apply_filters( 'auto_update_' . $type, $update, $item );