Categories: Snippets

Disable update notification for individual plugins / All

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' );

Disable All Update Notifications with Code

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');

 

Recent Posts

Adding or Including custom post type to default WordPress loop

Adding or Including custom post type to default WordPress loop by altering the 'pre_get_posts' function.…

5 years ago

How to Limit or Disable WordPress Post Revisions

Limit the number of posts revisions that WordPress stores in the database. edit wp-config.php file…

5 years ago

Multisite – List Recent Posts Across an Entire Network

In Multisite, List Recent Posts Across an Entire Network by using custom query or WP_Query…

5 years ago

How to change the WordPress permalink structure to remove dates from the URLs

Switching the permalink structure from /year/month/post-slug to just /post-slug is easy by going to Settings…

6 years ago

Limit character in content and title in wordpress

[crayon-662fe10cbb026480602217/] or with readmore [crayon-662fe10cbb02c203540583/]  

6 years ago

Hide page visual editor if certain template is selected

[crayon-662fe10cbb181334827648/]  

6 years ago