WP_Recovery_Mode::handle_exit_recovery_mode() WordPress Method
The WP_Recovery_Mode::handle_exit_recovery_mode() method is used to gracefully exit the recovery mode. This is useful when the site is no longer in need of recovery mode and you want to exit it without losing any data.
WP_Recovery_Mode::handle_exit_recovery_mode() #
Handles a request to exit Recovery Mode.
Source
File: wp-includes/class-wp-recovery-mode.php
public function handle_exit_recovery_mode() { $redirect_to = wp_get_referer(); // Safety check in case referrer returns false. if ( ! $redirect_to ) { $redirect_to = is_user_logged_in() ? admin_url() : home_url(); } if ( ! $this->is_active() ) { wp_safe_redirect( $redirect_to ); die; } if ( ! isset( $_GET['action'] ) || self::EXIT_ACTION !== $_GET['action'] ) { return; } if ( ! isset( $_GET['_wpnonce'] ) || ! wp_verify_nonce( $_GET['_wpnonce'], self::EXIT_ACTION ) ) { wp_die( __( 'Exit recovery mode link expired.' ), 403 ); } if ( ! $this->exit_recovery_mode() ) { wp_die( __( 'Failed to exit recovery mode. Please try again later.' ) ); } wp_safe_redirect( $redirect_to ); die; }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
5.2.0 | Introduced. |