Skip to content

Instantly share code, notes, and snippets.

@mizner
Created December 21, 2022 05:58
Show Gist options
  • Save mizner/e11d9f63fdb20a481e4bc999f01e97f3 to your computer and use it in GitHub Desktop.
Save mizner/e11d9f63fdb20a481e4bc999f01e97f3 to your computer and use it in GitHub Desktop.
WordPress Disable Core and Plugin Updates
<?php
/**
* Plugin Name: Updates Controller
* Description: Security upgrades and custom settings
* Version: 1.0.0
* License: GPL3+
*/
namespace MustUse\CustomSettings;
add_filter('pre_site_transient_update_core', __NAMESPACE__ . '\remove_core_updates');
add_filter('pre_site_transient_update_plugins', __NAMESPACE__ . '\remove_core_updates');
add_filter('pre_site_transient_update_themes', __NAMESPACE__ . '\remove_core_updates');
function remove_core_updates() {
global $wp_version;
return (object) array('last_checked' => time(), 'version_checked' => $wp_version,);
}
add_filter('site_transient_update_plugins', __NAMESPACE__ . '/disable_plugin_updates');
function disable_plugin_updates($value) {
unset($value->response[ plugin_basename(__FILE__) ]);
return $value;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment