We can prevent certain plugins from updating themselves or asking to be updated. It can be done using the http_request_args filter
if(!function_exists('custom_prevent_plugin_update_check')){
function custom_prevent_plugin_update_check( $r, $url ) {
if ( 0 === strpos( $url, 'http://api.wordpress.org/plugins/update-check/' ) ) {
$to_be_blocked = array('plugin-folder-name/plugin-filename.php');
/*Example: array('contact-form-7/wp-contact-form-7.php'). It will prevent contact-form-7 for update check.*/
/*We can block multiple plugins by specifying their names in this array as above. */
if (!empty($to_be_blocked)){
foreach ($to_be_blocked as $individual){
$plugins = unserialize( $r['body']['plugins'] );
unset( $plugins->plugins[$individual] );
unset( $plugins->active[array_search( $individual,
$plugins->active )] );
$r['body']['plugins'] = serialize( $plugins );
}
}
}
return $r;
}
}
add_filter( 'http_request_args', 'custom_prevent_plugin_update_check',10, 2 );
best plugin for wordpress blog?
ReplyDelete