update_nag

The WordPress Core update nag function.

Description

(false|void) update_nag(); 

Returns (false|void)


Usage

  1. if ( !function_exists( 'update_nag' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/update.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = update_nag(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/update.php  
  1. function update_nag() { 
  2. if ( is_multisite() && !current_user_can('update_core') ) 
  3. return false; 
  4.  
  5. global $pagenow; 
  6.  
  7. if ( 'update-core.php' == $pagenow ) 
  8. return; 
  9.  
  10.  
  11. if ( ! isset( $cur->response ) || $cur->response != 'upgrade' ) 
  12. return false; 
  13.  
  14. if ( current_user_can( 'update_core' ) ) { 
  15. $msg = sprintf( 
  16. /** translators: 1: Codex URL to release notes, 2: new WordPress version, 3: URL to network admin, 4: accessibility text */ 
  17. __( '<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.' ),  
  18. sprintf( 
  19. /** translators: %s: WordPress version */ 
  20. esc_url( __( 'https://codex.wordpress.org/Version_%s' ) ),  
  21. $cur->current 
  22. ),  
  23. $cur->current,  
  24. network_admin_url( 'update-core.php' ),  
  25. esc_attr__( 'Please update WordPress now' ) 
  26. ); 
  27. } else { 
  28. $msg = sprintf( 
  29. /** translators: 1: Codex URL to release notes, 2: new WordPress version */ 
  30. __( '<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.' ),  
  31. sprintf( 
  32. /** translators: %s: WordPress version */ 
  33. esc_url( __( 'https://codex.wordpress.org/Version_%s' ) ),  
  34. $cur->current 
  35. ),  
  36. $cur->current 
  37. ); 
  38. echo "<div class='update-nag'>$msg</div>";