Make WordPress Core

Opened 22 months ago

Last modified 22 months ago

#56473 new defect (bug)

Getting notice message I am disabling update notifications

Reported by: sumitsingh's profile sumitsingh Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.9.3
Component: Upgrade/Install Keywords: has-screenshots close
Focuses: administration Cc:

Description

Hey,

I am trying to disable Plugin/Theme/WP update notice notifications. after added code getting Notice on update-core.php page. More information you can see mentioned SS.

Thank you

Attachments (1)

bug.png (142.6 KB) - added by sumitsingh 22 months ago.

Download all attachments as: .zip

Change History (4)

@sumitsingh
22 months ago

#1 @sumitsingh
22 months ago

<?php
// Disable WordPress update notifications 
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'); //hide WordPress updates for ALL users 
if ( !current_user_can('administrator') ) {
  add_filter('pre_site_transient_update_plugins','remove_core_updates'); //hide all plugin updates for non-admins
  add_filter('pre_site_transient_update_themes','remove_core_updates'); //hide all theme updates for non-admins
}
?>

#2 @SergeyBiryukov
22 months ago

  • Component changed from Administration to Upgrade/Install

#3 @jrf
22 months ago

  • Keywords close added

@sumitsingh Your code is not returning a valid value for the transient. May I suggest you use one of the multitude of plugins which can help you achieve what you are trying to do instead ?

If you really want to sort this out yourself, please ask for help on how to do this on the support forum. Trac is for bugs in WordPress Core, not for bugs in userland code.

Note: See TracTickets for help on using tickets.