Skip to content

Commit

Permalink
Handle redirect to the right wizard url
Browse files Browse the repository at this point in the history
  • Loading branch information
Vlad Olaru committed Nov 18, 2019
1 parent 330ccf8 commit c9925c3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions admin/class-pixelgrade_assistant-setup_wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ public function init() {
public function register_hooks() {
add_action( 'admin_menu', array( $this, 'add_admin_menu' ) );
add_action( 'admin_init', array( $this, 'setup_wizard' ) );

// Handle the previous URL for the setup wizard:
// index.php?page=pixelgrade_assistant-setup-wizard
// instead of the new
// admin.php?page=pixelgrade_assistant-setup-wizard
add_action( 'admin_page_access_denied', array( $this, 'redirect_to_correct_url' ), 0 );
}

public function add_admin_menu() {
Expand Down Expand Up @@ -93,6 +99,13 @@ public function setup_wizard() {
exit;
}

public function redirect_to_correct_url() {
if ( ! empty( $_GET['page'] ) && 'pixelgrade_assistant-setup-wizard' === $_GET['page'] ) {
wp_safe_redirect( admin_url( 'admin.php?page=pixelgrade_assistant-setup-wizard' ) );
return;
}
}

/**
* Setup Wizard Header.
*/
Expand Down

0 comments on commit c9925c3

Please sign in to comment.