WordPress.org

Make WordPress Core

Ticket #31011: add_filters.patch

File add_filters.patch, 1.2 KB (added by Grezvany13, 5 years ago)

Add 3 filters (for core, plugin and theme) to enable/disable update checks

  • wp-includes/update.php

     
    2121 * @return null|false Returns null if update is unsupported. Returns false if check is too soon.
    2222 */
    2323function wp_version_check( $extra_stats = array(), $force_check = false ) {
    24         if ( defined('WP_INSTALLING') )
     24        if ( defined('WP_INSTALLING') || !apply_filters('check_update_core', true ) )
    2525                return;
    2626
    2727        global $wpdb, $wp_local_package;
     
    185185function wp_update_plugins( $extra_stats = array() ) {
    186186        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    187187
    188         if ( defined('WP_INSTALLING') )
     188        if ( defined('WP_INSTALLING') || !apply_filters('check_update_plugin', true ) )
    189189                return false;
    190190
    191191        // If running blog-side, bail unless we've not checked in the last 12 hours
     
    339339function wp_update_themes( $extra_stats = array() ) {
    340340        include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    341341
    342         if ( defined( 'WP_INSTALLING' ) )
     342        if ( defined( 'WP_INSTALLING' ) || !apply_filters('check_update_theme', true ) )
    343343                return false;
    344344
    345345        $installed_themes = wp_get_themes();