: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in
<td class="manage-column"><label for="plugins-select-all"><?php _e( 'Select All' ); ?></label></td>
if ( wp_is_auto_update_enabled_for_type( 'plugin' ) ) {
$auto_updates = (array) get_site_option( 'auto_update_plugins', array() );
$auto_update_notice = ' | ' . wp_get_auto_update_message();
foreach ( (array) $plugins as $plugin_file => $plugin_data ) {
$plugin_data = (object) _get_plugin_data_markup_translate( $plugin_file, (array) $plugin_data, false, true );
$icon = '<span class="dashicons dashicons-admin-plugins"></span>';
$preferred_icons = array( 'svg', '2x', '1x', 'default' );
foreach ( $preferred_icons as $preferred_icon ) {
if ( ! empty( $plugin_data->update->icons[ $preferred_icon ] ) ) {
$icon = '<img src="' . esc_url( $plugin_data->update->icons[ $preferred_icon ] ) . '" alt="" />';
// Get plugin compat for running version of WordPress.
if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $cur_wp_version, '>=' ) ) {
/* translators: %s: WordPress version. */
$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $cur_wp_version );
/* translators: %s: WordPress version. */
$compat = '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $cur_wp_version );
// Get plugin compat for updated version of WordPress.
if ( $core_update_version ) {
if ( isset( $plugin_data->update->tested ) && version_compare( $plugin_data->update->tested, $core_update_version, '>=' ) ) {
/* translators: %s: WordPress version. */
$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: 100%% (according to its author)' ), $core_update_version );
/* translators: %s: WordPress version. */
$compat .= '<br />' . sprintf( __( 'Compatibility with WordPress %s: Unknown' ), $core_update_version );
$requires_php = isset( $plugin_data->update->requires_php ) ? $plugin_data->update->requires_php : null;
$compatible_php = is_php_version_compatible( $requires_php );
if ( ! $compatible_php && current_user_can( 'update_php' ) ) {
$compat .= '<br />' . __( 'This update does not work with your version of PHP.' ) . ' ';
/* translators: %s: URL to Update PHP page. */
__( '<a href="%s">Learn more about updating PHP</a>.' ),
esc_url( wp_get_update_php_url() )
$annotation = wp_get_update_php_annotation();
$compat .= '</p><p><em>' . $annotation . '</em>';
// Get the upgrade notice for the new plugin version.
if ( isset( $plugin_data->update->upgrade_notice ) ) {
$upgrade_notice = '<br />' . strip_tags( $plugin_data->update->upgrade_notice );
$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data->update->slug . '§ion=changelog&TB_iframe=true&width=640&height=662' );
'<a href="%1$s" class="thickbox open-plugin-details-modal" aria-label="%2$s">%3$s</a>',
/* translators: 1: Plugin name, 2: Version number. */
esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_data->Name, $plugin_data->update->new_version ) ),
/* translators: %s: Plugin version. */
sprintf( __( 'View version %s details.' ), $plugin_data->update->new_version )
$checkbox_id = 'checkbox_' . md5( $plugin_file );
<td class="check-column">
<?php if ( $compatible_php ) : ?>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $plugin_file ); ?>" />
<label for="<?php echo $checkbox_id; ?>">
<span class="screen-reader-text">
/* translators: Hidden accessibility text. %s: Plugin name. */
printf( __( 'Select %s' ), $plugin_data->Name );
<td class="plugin-title"><p>
<strong><?php echo $plugin_data->Name; ?></strong>
/* translators: 1: Plugin version, 2: New version. */
__( 'You have version %1$s installed. Update to %2$s.' ),
$plugin_data->update->new_version
echo ' ' . $details . $compat;
if ( in_array( $plugin_file, $auto_updates, true ) ) {
echo $auto_update_notice;
<td class="manage-column check-column"><input type="checkbox" id="plugins-select-all-2" /></td>
<td class="manage-column"><label for="plugins-select-all-2"><?php _e( 'Select All' ); ?></label></td>
<p><input id="upgrade-plugins-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Plugins' ); ?>" name="upgrade" /></p>
* Display the upgrade themes form.
function list_theme_updates() {
$themes = get_theme_updates();
if ( empty( $themes ) ) {
echo '<h2>' . __( 'Themes' ) . '</h2>';
echo '<p>' . __( 'Your themes are all up to date.' ) . '</p>';
$form_action = 'update-core.php?action=do-theme-upgrade';
$themes_count = count( $themes );
'%s <span class="count">(%d)</span>',
number_format_i18n( $themes_count )
<p><?php _e( 'The following themes have new versions available. Check the ones you want to update and then click “Update Themes”.' ); ?></p>
/* translators: %s: Link to documentation on child themes. */
__( '<strong>Please Note:</strong> Any customizations you have made to theme files will be lost. Please consider using <a href="%s">child themes</a> for modifications.' ),
__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-themes" class="upgrade">
<?php wp_nonce_field( 'upgrade-core' ); ?>
<p><input id="upgrade-themes" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
<table class="widefat updates-table" id="update-themes-table">
<td class="manage-column check-column"><input type="checkbox" id="themes-select-all" /></td>
<td class="manage-column"><label for="themes-select-all"><?php _e( 'Select All' ); ?></label></td>
if ( wp_is_auto_update_enabled_for_type( 'theme' ) ) {
$auto_updates = (array) get_site_option( 'auto_update_themes', array() );
$auto_update_notice = ' | ' . wp_get_auto_update_message();
foreach ( $themes as $stylesheet => $theme ) {
$requires_wp = isset( $theme->update['requires'] ) ? $theme->update['requires'] : null;
$requires_php = isset( $theme->update['requires_php'] ) ? $theme->update['requires_php'] : null;
$compatible_wp = is_wp_version_compatible( $requires_wp );
$compatible_php = is_php_version_compatible( $requires_php );
if ( ! $compatible_wp && ! $compatible_php ) {
$compat .= '<br />' . __( 'This update 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>.' ),
esc_url( self_admin_url( 'update-core.php' ) ),
esc_url( wp_get_update_php_url() )
$annotation = wp_get_update_php_annotation();
$compat .= '</p><p><em>' . $annotation . '</em>';
} elseif ( current_user_can( 'update_core' ) ) {
/* translators: %s: URL to WordPress Updates screen. */
__( '<a href="%s">Please update WordPress</a>.' ),
esc_url( 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() )
$annotation = wp_get_update_php_annotation();
$compat .= '</p><p><em>' . $annotation . '</em>';
} elseif ( ! $compatible_wp ) {
$compat .= '<br />' . __( 'This update 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>.' ),
esc_url( self_admin_url( 'update-core.php' ) )
} elseif ( ! $compatible_php ) {
$compat .= '<br />' . __( 'This update 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() )
$annotation = wp_get_update_php_annotation();
$compat .= '</p><p><em>' . $annotation . '</em>';
$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
<td class="check-column">
<?php if ( $compatible_wp && $compatible_php ) : ?>
<input type="checkbox" name="checked[]" id="<?php echo $checkbox_id; ?>" value="<?php echo esc_attr( $stylesheet ); ?>" />
<label for="<?php echo $checkbox_id; ?>">
<span class="screen-reader-text">
/* translators: Hidden accessibility text. %s: Theme name. */
printf( __( 'Select %s' ), $theme->display( 'Name' ) );
<td class="plugin-title"><p>
<img src="<?php echo esc_url( $theme->get_screenshot() . '?ver=' . $theme->version ); ?>" width="85" height="64" class="updates-table-screenshot" alt="" />
<strong><?php echo $theme->display( 'Name' ); ?></strong>
/* translators: 1: Theme version, 2: New version. */
__( 'You have version %1$s installed. Update to %2$s.' ),
$theme->display( 'Version' ),
$theme->update['new_version']
if ( in_array( $stylesheet, $auto_updates, true ) ) {
echo $auto_update_notice;
<td class="manage-column check-column"><input type="checkbox" id="themes-select-all-2" /></td>
<td class="manage-column"><label for="themes-select-all-2"><?php _e( 'Select All' ); ?></label></td>
<p><input id="upgrade-themes-2" class="button" type="submit" value="<?php esc_attr_e( 'Update Themes' ); ?>" name="upgrade" /></p>
* Display the update translations form.
function list_translation_updates() {
$updates = wp_get_translation_updates();
if ( 'en_US' !== get_locale() ) {
echo '<h2>' . __( 'Translations' ) . '</h2>';
echo '<p>' . __( 'Your translations are all up to date.' ) . '</p>';
$form_action = 'update-core.php?action=do-translation-upgrade';
<h2><?php _e( 'Translations' ); ?></h2>
<form method="post" action="<?php echo esc_url( $form_action ); ?>" name="upgrade-translations" class="upgrade">
<p><?php _e( 'New translations are available.' ); ?></p>
<?php wp_nonce_field( 'upgrade-translations' ); ?>
<p><input class="button" type="submit" value="<?php esc_attr_e( 'Update Translations' ); ?>" name="upgrade" /></p>
* Upgrades WordPress core display.
* @global WP_Filesystem_Base $wp_filesystem WordPress filesystem subclass.
function do_core_upgrade( $reinstall = false ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
$url = 'update-core.php?action=do-core-reinstall';
$url = 'update-core.php?action=do-core-upgrade';
$url = wp_nonce_url( $url, 'upgrade-core' );
$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
$update = find_core_update( $version, $locale );
* Allow relaxed file ownership writes for User-initiated upgrades when the API specifies
* that it's safe to do so. This only happens when there are no new files to create.
$allow_relaxed_file_ownership = ! $reinstall && isset( $update->new_files ) && ! $update->new_files;
<h1><?php _e( 'Update WordPress' ); ?></h1>
$credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
if ( false === $credentials ) {
if ( ! WP_Filesystem( $credentials, ABSPATH, $allow_relaxed_file_ownership ) ) {
// Failed to connect. Error and request again.
request_filesystem_credentials( $url, '', true, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership );
if ( $wp_filesystem->errors->has_errors() ) {
foreach ( $wp_filesystem->errors->get_error_messages() as $message ) {
show_message( $message );
$update->response = 'reinstall';
add_filter( 'update_feedback', 'show_message' );
$upgrader = new Core_Upgrader();
$result = $upgrader->upgrade(
'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
if ( is_wp_error( $result ) ) {
if ( 'up_to_date' !== $result->get_error_code() && 'locked' !== $result->get_error_code() ) {
show_message( __( 'Installation failed.' ) );
show_message( __( 'WordPress updated successfully.' ) );
'<span class="hide-if-no-js">' . sprintf(
/* translators: 1: WordPress version, 2: URL to About screen. */
__( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ),
esc_url( self_admin_url( 'about.php?updated' ) )
'<span class="hide-if-js">' . sprintf(
/* translators: 1: WordPress version, 2: URL to About screen. */
__( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ),
esc_url( self_admin_url( 'about.php?updated' ) )
<script type="text/javascript">
window.location = '<?php echo esc_url( self_admin_url( 'about.php?updated' ) ); ?>';
function do_dismiss_core_update() {
$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
$update = find_core_update( $version, $locale );
dismiss_core_update( $update );
wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
* Undismiss a core update.
function do_undismiss_core_update() {
$version = isset( $_POST['version'] ) ? $_POST['version'] : false;
$locale = isset( $_POST['locale'] ) ? $_POST['locale'] : 'en_US';
$update = find_core_update( $version, $locale );
undismiss_core_update( $version, $locale );
wp_redirect( wp_nonce_url( 'update-core.php?action=upgrade-core', 'upgrade-core' ) );
$action = isset( $_GET['action'] ) ? $_GET['action'] : 'upgrade-core';
if ( ( 'do-theme-upgrade' === $action || ( 'do-plugin-upgrade' === $action && ! isset( $_GET['plugins'] ) ) )
&& ! isset( $_POST['checked'] ) ) {
$upgrade_error = ( 'do-theme-upgrade' === $action ) ? 'themes' : 'plugins';
$action = 'upgrade-core';
$title = __( 'WordPress Updates' );
$parent_file = 'index.php';
$updates_overview = '<p>' . __( 'On this screen, you can update to the latest version of WordPress, as well as update your themes, plugins, and translations from the WordPress.org repositories.' ) . '</p>';
$updates_overview .= '<p>' . __( 'If an update is available, you᾿ll see a notification appear in the Toolbar and navigation menu.' ) . ' ' . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ) . '</p>';
get_current_screen()->add_help_tab(
'title' => __( 'Overview' ),
'content' => $updates_overview,