升级成功后,重定向到关于WordPress页面。
原型
_redirect_to_about_wordpress( string $new_version )
描述
仅当现有安装早于3.4.0时才需要此功能。
参数
$new_version
(string)
(Required)
源文件
路径:wp-admin/includes/update-core.php
<?php
...
function _redirect_to_about_wordpress( $new_version ) {
global $wp_version, $pagenow, $action;
if ( version_compare( $wp_version, '3.4-RC1', '>=' ) )
return;
// Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
if ( 'update-core.php' != $pagenow )
return;
if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action )
return;
// Load the updated default text localization domain for new strings.
load_default_textdomain();
// See do_core_upgrade()
show_message( __('WordPress updated successfully') );
// self_admin_url() won't exist when upgrading from <= 3.0, so relative URLs are intentional.
show_message( '<span class="hide-if-no-js">' . sprintf( __( 'Welcome to WordPress %1$s. You will be redirected to the About WordPress screen. If not, click <a href="%2$s">here</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
show_message( '<span class="hide-if-js">' . sprintf( __( 'Welcome to WordPress %1$s. <a href="%2$s">Learn more</a>.' ), $new_version, 'about.php?updated' ) . '</span>' );
echo '</div>';
?>
<script type="text/javascript">
window.location = 'about.php?updated';
</script>
<?php
// Include admin-footer.php and exit.
include(ABSPATH . 'wp-admin/admin-footer.php');
exit();
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/_redirect_to_about_wordpress/