[ad_1]
I am trying to redirect users to the form page if they have not yet filled it so that if they visit the pages in my conditions, they can be redirected to back to fill the form first.
I have been able to redirect other pages properly but I’m having an issue with a page that contains a parameter.
The link https://example.com/wp-admin/admin.php?page=booknetic
I tried:
//Redirect user back to application form if they have not filled it
add_action( 'template_redirect', 'redirect_if_user_logged_in' );
function redirect_if_user_logged_in() {
if ( is_front_page() || isset($_GET['page']) || is_page('profile') || is_page('account')
&& is_user_logged_in() && $count == 0) {
wp_redirect( '/first-time-application-temp/');
exit;
}
}
AND
//Redirect user back to application form if they have not filled it
add_action( 'template_redirect', 'redirect_if_user_logged_in' );
function redirect_if_user_logged_in() {
if ( is_front_page() || $_SERVER['REQUEST_URI'] == '/wp-admin/admin.php?page=booknetic' || is_page('profile') || is_page('account')
&& is_user_logged_in() && $count == 0) {
wp_redirect( '/first-time-application-temp/');
exit;
}
}
is_front_page()
, and is_page('profile')
|| is_page('account') && is_user_logged_in() && $count == 0)
Note* $count
is a global variable that checks whether the user had an entry in the form.
How do I test whether the is_page == wp-admin/admin.php?page=booknetic
?
Could it be failing because the menu link is just a custom link that redirects to the page https://example.com/wp-admin/admin.php?page=booknetic
which is an existing page created by another plugin?
[ad_2]