I have a question related to the behaviour of WordPress.
I coded a function which on-call redirects the user to a page inside WordPress. I used it with add_query_arg()
.
Here is the function I created.
function wg_uep_license_fail_redirect( $message ) {
update_option( 'wg_uep_license_status', 'invalid' );
if ( ! empty( $message ) ) {
$redirectUrl = admin_url( 'admin.php?page=wp_uep');
$finalizedUrl = add_query_arg( array(
'license_activation' => 'false',
'message' => urlencode( $message ),
), $redirectUrl );
wp_redirect( $finalizedUrl );
// wp_die();
exit;
}
}
As you can see the function has a message parameter. Now if I call the function like this.
$message = 'hello dead';
wg_uep_license_fail_redirect( $message );
Everything works fine if I use exit
but if I uncomment wp_die()
and remove the exit
. Nothing seems to work.
Now my question is simple what is the difference. How WordPress handles the wp_die
or exit
?
NOTE: die()
also works but not wp_die()
.