Title: maintenance_nag
Published: April 25, 2014
Last modified: February 24, 2026

---

# maintenance_nag(): void|false

## In this article

 * [Return](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#wp--skip-link--target)

Displays maintenance nag HTML message.

## 󠀁[Return](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#return)󠁿

 void|false

## 󠀁[Source](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#source)󠁿

    ```php
    function maintenance_nag() {
    	global $upgrading;

    	$nag = isset( $upgrading );

    	if ( ! $nag ) {
    		$failed = get_site_option( 'auto_core_update_failed' );
    		/*
    		 * If an update failed critically, we may have copied over version.php but not other files.
    		 * In that case, if the installation claims we're running the version we attempted, nag.
    		 * This is serious enough to err on the side of nagging.
    		 *
    		 * If we simply failed to update before we tried to copy any files, then assume things are
    		 * OK if they are now running the latest.
    		 *
    		 * This flag is cleared whenever a successful update occurs using Core_Upgrader.
    		 */
    		$comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
    		if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], wp_get_wp_version(), $comparison ) ) {
    			$nag = true;
    		}
    	}

    	if ( ! $nag ) {
    		return false;
    	}

    	if ( current_user_can( 'update_core' ) ) {
    		$msg = sprintf(
    			/* translators: %s: URL to WordPress Updates screen. */
    			__( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ),
    			'update-core.php'
    		);
    	} else {
    		$msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
    	}

    	wp_admin_notice(
    		$msg,
    		array(
    			'type'               => 'warning',
    			'additional_classes' => array( 'update-nag', 'inline' ),
    			'paragraph_wrap'     => false,
    		)
    	);
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/update.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-admin/includes/update.php#L853)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-admin/includes/update.php#L853-L898)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_get_wp_version()](https://developer.wordpress.org/reference/functions/wp_get_wp_version/)`wp-includes/functions.php` |

Returns the current WordPress version.

  | 
| [wp_admin_notice()](https://developer.wordpress.org/reference/functions/wp_admin_notice/)`wp-includes/functions.php` |

Outputs an admin notice.

  | 
| [current_user_can()](https://developer.wordpress.org/reference/functions/current_user_can/)`wp-includes/capabilities.php` |

Returns whether the current user has the specified capability.

  | 
| [__()](https://developer.wordpress.org/reference/functions/__/)`wp-includes/l10n.php` |

Retrieves the translation of $text.

  | 
| [get_site_option()](https://developer.wordpress.org/reference/functions/get_site_option/)`wp-includes/option.php` |

Retrieve an option value for the current network based on name of option.

  |

[Show 3 more](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#)
[Show less](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#)

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/maintenance_nag/?output_format=md#changelog)󠁿

| Version | Description | 
| [2.7.0](https://developer.wordpress.org/reference/since/2.7.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fmaintenance_nag%2F)
before being able to contribute a note or feedback.