Last active
          February 3, 2025 03:41 
        
      - 
      
 - 
        
Save waviaei/3abe758349edf00378f4e3561739f6ed to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | # 更新通知のメモ | |
| ## コアのアップデートの通知 | |
| - シングルサイトの場合 | |
| - administrator もしくは `current_user_can( 'update_core' )` | |
| - `<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.` | |
| - administrator 以外 | |
| - `<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.` | |
| - マルチサイトの場合 | |
| - super-admin もしくは `current_user_can( 'update_core' )` | |
| - `<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.` | |
| - super-admin ではない各サイトの全ての権限グループ | |
| - 何も表示されない | |
| https://kinsta.com/knowledgebase/disable-wordpress-update-notification/#hide-update-notifications-in-dashboard | |
| の2つ目参考 | |
| ``` | |
| // Hide dashboard update notifications for non-admin users | |
| function kinsta_hide_update_nag() { | |
| if ( ! current_user_can( 'update_core' ) ) { | |
| remove_action( 'admin_notices', 'update_nag', 3 ); | |
| } | |
| } | |
| add_action('admin_menu','kinsta_hide_update_nag'); | |
| ``` | |
| マルチサイトの場合はそもそも super-admin にしか通知がでない。 | |
| [update_nag()](https://developer.wordpress.org/reference/functions/update_nag/)の先頭で確認が入っている。 | |
| ``` | |
| function update_nag() { | |
| global $pagenow; | |
| if ( is_multisite() && ! current_user_can( 'update_core' ) ) { | |
| return false; | |
| } | |
| ``` | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment