wp_is_recovery_mode example

$shake_error_codes = apply_filters( 'shake_error_codes', $shake_error_codes );

    if ( $shake_error_codes && $wp_error->has_errors() && in_array( $wp_error->get_error_code()$shake_error_codes, true ) ) {
        add_action( 'login_footer', 'wp_shake_js', 12 );
    }

    $login_title = get_bloginfo( 'name', 'display' );

    /* translators: Login screen title. 1: Login screen name, 2: Network or site name. */
    $login_title = sprintf( __( '%1$s ‹ %2$s — WordPress' )$title$login_title );

    if ( wp_is_recovery_mode() ) {
        /* translators: %s: Login screen title. */
        $login_title = sprintf( __( 'Recovery Mode — %s' )$login_title );
    }

    /** * Filters the title tag content for login page. * * @since 4.9.0 * * @param string $login_title The page title, with extra context added. * @param string $title The original page title. */
__( '%1$s “%2$s”' ),
                $post_type_obj->labels->edit_item,
                $post_title
            );
        }
    }

    /* translators: Admin screen title. 1: Admin screen name, 2: Network or site name. */
    $admin_title = sprintf( __( '%1$s ‹ %2$s — WordPress' )$screen_title$admin_title );
}

if ( wp_is_recovery_mode() ) {
    /* translators: %s: Admin screen title. */
    $admin_title = sprintf( __( 'Recovery Mode — %s' )$admin_title );
}

/** * Filters the title tag content for an admin page. * * @since 3.1.0 * * @param string $admin_title The page title, with extra context added. * @param string $title The original page title. */
$nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
    update_option( 'theme_switch_menu_locations', $nav_menu_locations );

    if ( func_num_args() > 1 ) {
        $stylesheet = func_get_arg( 1 );
    }

    $old_theme = wp_get_theme();
    $new_theme = wp_get_theme( $stylesheet );
    $template  = $new_theme->get_template();

    if ( wp_is_recovery_mode() ) {
        $paused_themes = wp_paused_themes();
        $paused_themes->delete( $old_theme->get_stylesheet() );
        $paused_themes->delete( $old_theme->get_template() );
    }

    update_option( 'template', $template );
    update_option( 'stylesheet', $stylesheet );

    if ( count( $wp_theme_directories ) > 1 ) {
        update_option( 'template_root', get_raw_theme_root( $template, true ) );
        update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) );
    }
<?php }

/** * Displays a notice when the user is in recovery mode. * * @since 5.2.0 */
function wp_recovery_mode_nag() {
    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 );

    ?> <div class="notice notice-info"> <p> <?php
wp_load_translations_early();
        }

        if ( ! function_exists( 'wp_die' ) ) {
            require_once ABSPATH . WPINC . '/functions.php';
        }

        if ( ! class_exists( 'WP_Error' ) ) {
            require_once ABSPATH . WPINC . '/class-wp-error.php';
        }

        if ( true === $handled && wp_is_recovery_mode() ) {
            $message = __( 'There has been a critical error on this website, putting it in recovery mode. Please check the Themes and Plugins screens for more details. If you just installed or updated a theme or plugin, check the relevant page for that first.' );
        } elseif ( is_protected_endpoint() && wp_recovery_mode()->is_initialized() ) {
            if ( is_multisite() ) {
                $message = __( 'There has been a critical error on this website. Please reach out to your site administrator, and inform them of this error for further assistance.' );
            } else {
                $message = __( 'There has been a critical error on this website. Please check your site admin email inbox for instructions.' );
            }
        } else {
            $message = __( 'There has been a critical error on this website.' );
        }

        

        }

        if ( true !== $network_wide ) {
            $key = array_search( $plugin$current, true );
            if ( false !== $key ) {
                $do_blog = true;
                unset( $current[ $key ] );
            }
        }

        if ( $do_blog && wp_is_recovery_mode() ) {
            list( $extension ) = explode( '/', $plugin );
            wp_paused_plugins()->delete( $extension );
        }

        if ( ! $silent ) {
            /** * Fires as a specific plugin is being deactivated. * * This hook is the "deactivation" hook used internally by register_deactivation_hook(). * The dynamic portion of the hook name, `$plugin`, refers to the plugin basename. * * If a plugin is silently deactivated (such as during an update), this hook does not fire. * * @since 2.0.0 * * @param bool $network_deactivating Whether the plugin is deactivated for all sites in the network * or just the current site. Multisite only. Default false. */
            // Not already included as a network plugin.             && ( ! $network_plugins || ! in_array( WP_PLUGIN_DIR . '/' . $plugin$network_plugins, true ) )
        ) {
            $plugins[] = WP_PLUGIN_DIR . '/' . $plugin;
        }
    }

    /* * Remove plugins from the list of active plugins when we're on an endpoint * that should be protected against WSODs and the plugin is paused. */
    if ( wp_is_recovery_mode() ) {
        $plugins = wp_skip_paused_plugins( $plugins );
    }

    return $plugins;
}

/** * Filters a given list of plugins, removing any paused plugins from it. * * @since 5.2.0 * * @param string[] $plugins Array of absolute plugin main file paths. * @return string[] Filtered array of plugins, without any paused plugins. */

}

/** * Adds a link to exit recovery mode when Recovery Mode is active. * * @since 5.2.0 * * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance. */
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',
            
Home | Imprint | This part of the site doesn't use cookies.