maintenance_nag

The WordPress Core maintenance nag function.

Description

(false|void) maintenance_nag(); 

Returns (false|void)


Usage

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

Defined (1)

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

/wp-admin/includes/update.php  
  1. function maintenance_nag() { 
  2. include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 
  3. global $upgrading; 
  4. $nag = isset( $upgrading ); 
  5. if ( ! $nag ) { 
  6. $failed = get_site_option( 'auto_core_update_failed' ); 
  7. /** 
  8. * If an update failed critically, we may have copied over version.php but not other files. 
  9. * In that case, if the install claims we're running the version we attempted, nag. 
  10. * This is serious enough to err on the side of nagging. 
  11. * If we simply failed to update before we tried to copy any files, then assume things are 
  12. * OK if they are now running the latest. 
  13. * This flag is cleared whenever a successful update occurs using Core_Upgrader. 
  14. */ 
  15. $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; 
  16. if ( version_compare( $failed['attempted'], $wp_version, $comparison ) ) 
  17. $nag = true; 
  18.  
  19. if ( ! $nag ) 
  20. return false; 
  21.  
  22. if ( current_user_can('update_core') ) 
  23. $msg = sprintf( __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), 'update-core.php' ); 
  24. else 
  25. $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.'); 
  26.  
  27. echo "<div class='update-nag'>$msg</div>";