Automatically switch language based on visitor’s country
Automatically switch language based on visitor’s country
Automatically switch language based on visitor’s country
can you add this code in your archive-ticket.php before get_header(). please check below snap for the same. $user = wp_get_current_user(); $roles = (array) $user->roles; $current_role = $roles[0]; $allowed_role = array(‘administrator’); if (!is_user_logged_in() || !in_array($current_role, $allowed_role)) { wp_redirect(site_url()); } Thanks.
Please try this code. function redirect_user() { if ( is_user_logged_in() && ! is_page( ‘login’ ) ) { $return_url = esc_url( home_url( ‘/your-custom-login-page/’ ) ); wp_redirect( $return_url ); exit; } } add_action( ‘template_redirect’, ‘redirect_user’ );
You can check, if a user is logged in with is_user_logged_in() and for certain page with is_page(). If conditions are met, redirect the user with wp_redirect(). function redirect_non_loggedin_user() { // if user is on certain page and not logged in if ( ! is_user_logged_in() && is_page(‘instructions-for-contributors’) ) { // redirect to login page and back … Read more
Redirect *.php to path using web.config file
Any reason why you need to keep the ?page= in the url? If you just need to get the value of the page you can use: // will return value after “paged” pages “test/page/2” $paged will be 2 $paged = get_query_var(‘page’);
Mailjet Email Subscription + Redirect w/ Custom Template Fails
Random redirect to wp-admin/install.php
That’s because you’re using a post action which sends the user to another website. The template_redirect never runs because the user isn’t on your site any more. You’ll need to keep them on the site, register the new user then send them to the gateway with the post data.
Unexpected: WordPress redirects to the WP_HOME/WP_SITEURL value