Make WordPress Core

Opened 3 years ago

Closed 5 months ago

Last modified 4 months ago

#56473 closed defect (bug) (invalid)

Getting notice message I am disabling update notifications

Reported by: sumitsingh's profile sumitsingh Owned by:
Milestone: 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 3 years ago.

Download all attachments as: .zip

Change History (6)

@sumitsingh
3 years ago

#1 @sumitsingh
3 years 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
3 years ago

  • Component changed from Administration to Upgrade/Install

#3 @jrf
3 years 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.

#4 @mindctrl
5 months ago

  • Resolution set to invalid
  • Status changed from new to closed

Hi all,

Since this was a bug in the reporter's code and there's no bug in WordPress itself, I'm going to close this ticket to help clean up Trac. Feel free to reopen if there's a demonstrable bug in WordPress that needs to be fixed.

#5 @peterwilsoncc
4 months ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.