wp_admin_bar_recovery_mode_menu() WordPress Function

The wp_admin_bar_recovery_mode_menu() function is used to add a new top-level menu item to the WordPress admin bar. This new menu item allows you to quickly enter recovery mode, which is a special mode designed to help you troubleshoot issues with your WordPress site. When you enter recovery mode, all of your WordPress site's plugins and themes are disabled. This can be helpful if you're having issues with a plugin or theme that's causing problems on your site. Recovery mode also disables all of WordPress' built-in caching mechanisms, which can be helpful if you're trying to debug a caching issue. To enter recovery mode, simply click on the new "Recovery Mode" menu item that's added to the WordPress admin bar by this function. You will be prompted to enter your WordPress password. Once you've entered your password, you will be in recovery mode and can start troubleshooting any issues you're having with your WordPress site.

wp_admin_bar_recovery_mode_menu( WP_Admin_Bar $wp_admin_bar ) #

Adds a link to exit recovery mode when Recovery Mode is active.


Parameters

$wp_admin_bar

(WP_Admin_Bar)(Required)The WP_Admin_Bar instance.


Top ↑

Source

File: wp-includes/admin-bar.php

function wp_admin_bar_recovery_mode_menu( $wp_admin_bar ) {
	if ( ! wp_is_recovery_mode() ) {
		return;
	}

	$url = wp_login_url();
	$url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url );
	$url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION );

	$wp_admin_bar->add_node(
		array(
			'parent' => 'top-secondary',
			'id'     => 'recovery-mode',
			'title'  => __( 'Exit Recovery Mode' ),
			'href'   => $url,
		)
	);
}


Top ↑

Changelog

Changelog
VersionDescription
5.2.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.