Skip to main content
improve the source, wp codex for better readability.
Source Link
bueltge
  • 17.1k
  • 7
  • 61
  • 97

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

// remove update notice for forked plugins
function remove_update_notifications($value) { 

    if ( isset( $value ) && is_object( $value ) ) {
        unset( $value->response[ plugin_basename(__FILE__) ] );
    }

    return $value;
}
add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

// remove update notice for forked plugins
function remove_update_notifications( $value ) {
    
    if ( isset( $value ) && is_object( $value ) ) {
        unset( $value->response[ 'hello.php' ] );
        unset( $value->response[ 'akismet/akismet.php' ] );
    }
    
    return $value;
}
add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    }

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

// remove update notice for forked plugins
function remove_update_notifications($value) { 

    if ( isset( $value ) && is_object( $value ) ) {
        unset( $value->response[ plugin_basename(__FILE__) ] );
    }

    return $value;
}
add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

// remove update notice for forked plugins
function remove_update_notifications( $value ) {
    
    if ( isset( $value ) && is_object( $value ) ) {
        unset( $value->response[ 'hello.php' ] );
        unset( $value->response[ 'akismet/akismet.php' ] );
    }
    
    return $value;
}
add_filter( 'site_transient_update_plugins', 'remove_update_notifications' );

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    }

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    }

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    }

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');
Fix: You should return $value at the end or it will disable all plugins.
Source Link

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    } 

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    }
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

Hameedullah Khan's answer will throw a PHP warning. Include this if clause to check to make sure it's an object before unsetting the response for that plugin.

'Warning: Attempt to modify property of non-object'

Try this to avoid the warnings (code for the plugin file itself):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ plugin_basename(__FILE__) ]);
    } 

    return $value;
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');

I like to put this in the actual plugin. Since I've only ever disabled updates on a plugin because I've edited or forked the code and don't want to lose my edits on an update, I've already edited the plugin and thus don't mind editing it more. It keeps my functions file a bit cleaner. But if you wish you can put it in the functions file and a benefit to that method is you can remove multiple plugins from updates by adding another unset line for that plugin like so (code for functions.php):

//remove update notice for forked plugins
function remove_update_notifications($value) {
    if ( isset( $value ) && is_object( $value ) ) {
        unset($value->response[ 'hello.php' ]);
        unset($value->response[ 'akismet/akismet.php' ]);
    }
}
add_filter('site_transient_update_plugins', 'remove_update_notifications');
improved formatting
Source Link
circlecube
  • 613
  • 5
  • 8
Loading
Source Link
circlecube
  • 613
  • 5
  • 8
Loading