_redirect_to_about_wordpress

函式
_redirect_to_about_wordpress ( $new_version )
引數
  • (string) $new_version
    Required:
定義位置
相關方法
get_the_author_postsredirect_postrender_block_core_rssredirect_this_siteregister_block_core_rss
引入
3.3.0
棄用
-

_redirect_to_about_wordpress: 這個函式將使用者重定向到儀表盤中的關於WordPress頁面。

升級成功後重定向到關於WordPress的頁面。

這個函式只有在現有的安裝版本超過3.4.0時才需要。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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(
/* 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>.' ),
$new_version,
'about.php?updated'
) . '</span>'
);
show_message(
'<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>.' ),
$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.
require_once ABSPATH . 'wp-admin/admin-footer.php';
exit;
}
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( /* 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>.' ), $new_version, 'about.php?updated' ) . '</span>' ); show_message( '<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>.' ), $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. require_once ABSPATH . 'wp-admin/admin-footer.php'; exit; }
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(
			/* 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>.' ),
			$new_version,
			'about.php?updated'
		) . '</span>'
	);
	show_message(
		'<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>.' ),
			$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.
	require_once ABSPATH . 'wp-admin/admin-footer.php';
	exit;
}

常見問題

FAQs
檢視更多 >