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