WordPress.org

Ready to get started?Download WordPress

Forums

Disable WordPress Core Updates
PHP Notices (7 posts)

  1. Robert Chapin
    Member
    Posted 1 year ago #

    In both 3.4.2 and 3.5-RC5, visiting /wp-admin/update-core.php with this plugin enabled causes nine PHP Notices to be displayed. Could you please fix this?

    This is all you have to do:

    add_filter( 'site_transient_update_core', 'break_updates', 10, 1 );
    
    function break_updates($update) {
    	if ( isset($update->response) and 'latest' != $update->response and 'development' != $update->response )
    		$update->response = 'latest';
    
    	return $update;
    }

    And by the way, this plugin doesn't disable update checking. The plugin description is not accurate.

    http://wordpress.org/extend/plugins/disable-wordpress-core-update/

  2. Robert Chapin
    Member
    Posted 1 year ago #

    Correction, it looks like the value of the update_core transient is an array, not an object. I'll work on this some more. Do you have any interest in collaborating on this? Otherwise, I'll just end up using my own plugin from scratch.

  3. John Blackbourn
    Member
    Plugin Author

    Posted 1 year ago #

    Thanks for the code you sent the other day on IRC Robert. I'll get an update out shortly.

  4. wycks
    Member
    Posted 1 year ago #

    As Robert Chapin said the problem is that it will ping for updates on every load when these filters are set (so it seems).

    I have used this to remove it it from pinging for updates and the nag screen,

    function remove_core_updates(){
    
            global $wp_version;
            return (object) array(
                'last_checked' => time(),
                'version_checked' => $wp_version,
                );
    }
    add_filter('pre_site_transient_update_core', 'remove_core_updates');
    add_filter('pre_site_transient_update_plugins', 'remove_core_updates');
    add_filter('pre_site_transient_update_themes', 'remove_core_updates');

    It still throws a PHP warning "“Trying to get property of non-object", no idea how to fix that without changing core, also there seems to be no way to hook into dismissed_updates.

  5. Robert Chapin
    Member
    Posted 1 year ago #

    Hi wycks,

    I'll just share the code I came up with. John might be too busy to work on his own code.

    <?php
    /**
     * Plugin Name:  Disable Core Update
     * Description:  Disables WordPress core update notifications.
     * Version:      1.1
     * Author:       Robert Chapin (miqrogroove)
     * Author URI:   http://www.miqrogroove.com/
     * @license GPL
     */
    
    add_filter( 'site_transient_update_core', 'break_updates', 10, 1 );
    remove_action( 'wp_version_check', 'wp_version_check' );
    remove_action( 'admin_init', '_maybe_update_core' );
    
    function break_updates($from_api) {
    	if ( !isset( $from_api->updates ) || !is_array( $from_api->updates ) ) return $from_api;
    
    	foreach($from_api->updates as $i => $update) {
    		if ( isset($update->response) and 'latest' != $update->response and 'development' != $update->response ) {
    			$from_api->updates[$i]->response = 'latest';
    		}
    	}
    
    	return $from_api;
    }
    ?>
  6. wycks
    Member
    Posted 1 year ago #

    Thanks Robert Chapin , unfortunately that does not remove it from pinging for updates on every re-refresh, as far as I can tell it will still check for updates. This might have to be a trac issue.

    Trying to set pre_site_transient_update_core to remove pings results in:

    Trying to get property of non-object
    list_core_update( )  update-core.php:156
  7. Robert Chapin
    Member
    Posted 1 year ago #

    As I mentioned in the first post, this plugin doesn't disable update checking.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.