Update Blocker is a lightweight generic blocker of plugin, theme, and core updates from official WordPress repositories.
It was created as shared reusable plugin for the sake of no longer reinventing that particular wheel.
- single main file
mu-plugins–friendly- no hard dependencies
- interface
- elaborate API
- as–library use
- unreasonable compat
- Download ZIP.
- Unpack files from inside into
wp-content/plugins/update-blocker.
- Download
update-blocker.php. - Place into
wp-content/mu-plugins. - Edit settings for blocks in the file.
Create project in the wp-content/plugins:
composer create-project rarst/update-blocker:~1.0
Or require in composer.json of site project:
{
"require": {
"rarst/update-blocker": "~1.0"
}
}Requiring on plugin/theme level is not implemented, use suggest:
{
"suggest": {
"rarst/update-blocker": "Prevents invalid updates from official repositories"
}
}Plugin's settings have following structure:
array(
'all' => false,
'files' => array( '.git', '.svn', '.hg' ),
'plugins' => array( 'update-blocker/update-blocker.php' ),
'themes' => array(),
'core' => false,
)all— boolean, disables updates completelyfiles— array of plugin/theme root–relative files to detect for blockplugins— array of plugin base names (folder-name/plugin-name.php) to blockthemes— array of theme slugs (theme-name) to blockcore— boolean, disables core updates
Settings pass through update_blocker_blocked filter.
Processed data passes through update_blocker_plugins and update_blocker_themes filters during update checks.
add_filter( 'update_blocker_blocked', function( $blocked ) {
$blocked['plugins'][] = plugin_basename( __FILE__ ); // or just folder-name/plugin-name.php string
return $blocked;
} );add_filter( 'update_blocker_blocked', function( $blocked ) {
$blocked['themes'][] = 'theme-name';
return $blocked;
} );add_filter( 'update_blocker_blocked', function ( $blocked ) {
$blocked['core'] = true;
return $blocked;
} );- MIT