: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
if ( is_network_admin() || ! is_multisite() ) {
if ( is_network_admin() ) {
$active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
$active_class = is_plugin_active( $file ) ? ' active' : '';
$requires_php = isset( $response->requires_php ) ? $response->requires_php : null;
$compatible_php = is_php_version_compatible( $requires_php );
$notice_type = $compatible_php ? 'notice-warning' : 'notice-error';
'<tr class="plugin-update-tr%s" id="%s" data-slug="%s" data-plugin="%s">' .
'<td colspan="%s" class="plugin-update colspanchange">' .
'<div class="update-message notice inline %s notice-alt"><p>',
esc_attr( $plugin_slug . '-update' ),
esc_attr( $plugin_slug ),
esc_attr( $wp_list_table->get_column_count() ),
if ( ! current_user_can( 'update_plugins' ) ) {
/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Plugin name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
esc_attr( $response->new_version )
} elseif ( empty( $response->package ) ) {
/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Plugin name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
esc_attr( $response->new_version )
/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Plugin name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
esc_attr( $response->new_version ),
wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ),
'class="update-link" aria-label="%s"',
/* translators: %s: Plugin name. */
esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) )
/* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number 5: URL to Update PHP page. */
__( 'There is a new version of %1$s available, but it does not work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Plugin name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
esc_attr( $response->new_version ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '<br><em>', '</em>' );
* Fires at the end of the update message container in each
* row of the plugins list table.
* The dynamic portion of the hook name, `$file`, refers to the path
* of the plugin's primary file relative to the plugins directory.
* @param array $plugin_data An array of plugin metadata. See get_plugin_data()
* and the {@see 'plugin_row_meta'} filter for the list
* @param object $response {
* An object of metadata about the available plugin update.
* @type string $id Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
* @type string $slug Plugin slug.
* @type string $plugin Plugin basename.
* @type string $new_version New plugin version.
* @type string $url Plugin URL.
* @type string $package Plugin update package URL.
* @type string[] $icons An array of plugin icon URLs.
* @type string[] $banners An array of plugin banner URLs.
* @type string[] $banners_rtl An array of plugin RTL banner URLs.
* @type string $requires The version of WordPress which the plugin requires.
* @type string $tested The version of WordPress the plugin is tested against.
* @type string $requires_php The version of PHP which the plugin requires.
do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
echo '</p></div></td></tr>';
* Retrieves themes with updates available.
function get_theme_updates() {
$current = get_site_transient( 'update_themes' );
if ( ! isset( $current->response ) ) {
$update_themes = array();
foreach ( $current->response as $stylesheet => $data ) {
$update_themes[ $stylesheet ] = wp_get_theme( $stylesheet );
$update_themes[ $stylesheet ]->update = $data;
* Adds a callback to display update information for themes with updates available.
function wp_theme_update_rows() {
if ( ! current_user_can( 'update_themes' ) ) {
$themes = get_site_transient( 'update_themes' );
if ( isset( $themes->response ) && is_array( $themes->response ) ) {
$themes = array_keys( $themes->response );
foreach ( $themes as $theme ) {
add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 );
* Displays update information for a theme.
* @param string $theme_key Theme stylesheet.
* @param WP_Theme $theme Theme object.
function wp_theme_update_row( $theme_key, $theme ) {
$current = get_site_transient( 'update_themes' );
if ( ! isset( $current->response[ $theme_key ] ) ) {
$response = $current->response[ $theme_key ];
$details_url = add_query_arg(
$current->response[ $theme_key ]['url']
/** @var WP_MS_Themes_List_Table $wp_list_table */
$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
$active = $theme->is_allowed( 'network' ) ? ' active' : '';
$requires_wp = isset( $response['requires'] ) ? $response['requires'] : null;
$requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
$compatible_wp = is_wp_version_compatible( $requires_wp );
$compatible_php = is_php_version_compatible( $requires_php );
'<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
'<td colspan="%s" class="plugin-update colspanchange">' .
'<div class="update-message notice inline notice-warning notice-alt"><p>',
esc_attr( $theme->get_stylesheet() . '-update' ),
esc_attr( $theme->get_stylesheet() ),
$wp_list_table->get_column_count()
if ( $compatible_wp && $compatible_php ) {
if ( ! current_user_can( 'update_themes' ) ) {
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
} elseif ( empty( $response['package'] ) ) {
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
/* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */
__( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ),
'class="thickbox open-plugin-details-modal" aria-label="%s"',
/* translators: 1: Theme name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
$response['new_version'],
wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ),
'class="update-link" aria-label="%s"',
/* translators: %s: Theme name. */
esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) )
if ( ! $compatible_wp && ! $compatible_php ) {
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ),
if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
/* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */
' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ),
self_admin_url( 'update-core.php' ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '</p><p><em>', '</em>' );
} elseif ( current_user_can( 'update_core' ) ) {
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
} elseif ( current_user_can( 'update_php' ) ) {
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '</p><p><em>', '</em>' );
} elseif ( ! $compatible_wp ) {
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
if ( current_user_can( 'update_core' ) ) {
/* translators: %s: URL to WordPress Updates screen. */
' ' . __( '<a href="%s">Please update WordPress</a>.' ),
self_admin_url( 'update-core.php' )
} elseif ( ! $compatible_php ) {
/* translators: %s: Theme name. */
__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
if ( current_user_can( 'update_php' ) ) {
/* translators: %s: URL to Update PHP page. */
' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
wp_update_php_annotation( '</p><p><em>', '</em>' );
* Fires at the end of the update message container in each
* row of the themes list table.
* The dynamic portion of the hook name, `$theme_key`, refers to
* the theme slug as found in the WordPress.org themes repository.
* @param WP_Theme $theme The WP_Theme object.
* @param array $response {
* An array of metadata about the available theme update.
* @type string $new_version New theme version.
* @type string $url Theme URL.
* @type string $package Theme update package URL.
do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
echo '</p></div></td></tr>';
* Displays maintenance nag HTML message.
function maintenance_nag() {
// Include an unmodified $wp_version.
require ABSPATH . WPINC . '/version.php';
$nag = isset( $upgrading );
$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_version, $comparison ) ) {
if ( current_user_can( 'update_core' ) ) {
/* 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>.' ),
$msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
'additional_classes' => array( 'update-nag', 'inline' ),
'paragraph_wrap' => false,
* Prints the JavaScript templates for update admin notices.
* Template takes one argument with four values:
* Arguments for admin notice.
* @type string id ID of the notice.
* @type string className Class names for the notice.
* @type string message The notice's message.
* @type string type The type of update the notice is for. Either 'plugin' or 'theme'.
function wp_print_admin_notice_templates() {
<script id="tmpl-wp-updates-admin-notice" type="text/html">
<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
<script id="tmpl-wp-bulk-updates-admin-notice" type="text/html">
<div id="{{ data.id }}" class="{{ data.className }} notice <# if ( data.errorMessage ) { #>notice-error<# } else { #>notice-success<# } #>">
<# if ( data.successMessage ) { #>
{{{ data.successMessage }}}
<# if ( data.errorMessage ) { #>
<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
{{{ data.errorMessage }}}
<span class="screen-reader-text">
/* translators: Hidden accessibility text. */
_e( 'Show more details' );
<span class="toggle-indicator" aria-hidden="true"></span>
<# if ( data.errorMessages ) { #>
<ul class="bulk-action-errors hidden">
<# _.each( data.errorMessages, function( errorMessage ) { #>
<li>{{ errorMessage }}</li>
* Prints the JavaScript templates for update and deletion rows in list tables.
* The update template takes one argument with four values:
* Arguments for the update row
* @type string slug Plugin slug.
* @type string plugin Plugin base name.
* @type string colspan The number of table columns this row spans.
* @type string content The row content.
* The delete template takes one argument with four values:
* Arguments for the update row
* @type string slug Plugin slug.
* @type string plugin Plugin base name.
* @type string name Plugin name.
* @type string colspan The number of table columns this row spans.
function wp_print_update_row_templates() {
<script id="tmpl-item-update-row" type="text/template">
<tr class="plugin-update-tr update" id="{{ data.slug }}-update" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
<script id="tmpl-item-deleted-row" type="text/template">
<tr class="plugin-deleted-tr inactive deleted" id="{{ data.slug }}-deleted" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
<# if ( data.plugin ) { #>
/* translators: %s: Plugin name. */
_x( '%s was successfully deleted.', 'plugin' ),