Display custom messages based on user role while logging in
Display custom messages based on user role while logging in
Display custom messages based on user role while logging in
How to redirect non admin user after login
Thanks to Tom, I understood how this works… I did not have any pages with the URL /shows-events/ so there is nowhere to redirect to When the user accesses the existing page /event/, it triggers a redirect to /shows-events/ (which does not exist), but because of WordPress’ canonical redirect, it returns to the existing URL …
Figured it out. I just needed to be using $_SERVER[‘HTTP_REFERER’] instead: //Modify password reset message and include redirect to referring page add_filter( ‘retrieve_password_message’, ‘collab_retrieve_password_message’, 10, 4 ); function collab_retrieve_password_message( $message, $key, $user_login, $user_data ) { $site_name = wp_specialchars_decode( get_option( ‘blogname’ ), ENT_QUOTES ); $message = __( ‘Someone has requested a password reset for the following …
The problem is that is_category does not do what you thought it does. is_category( ‘keep’ ) tests that the current page is a category archive for the category keep, it does not check if the current attachment/post is in the keep category. The official WordPress developers docs for is_category start with: Determines whether the query …
You could try something like the code below. <?php /** * Use the two lines below if the user_id is not available * via get_current_user_id at this point in code execution. * * $user_id = apply_filters( ‘determine_current_user’, false ); * wp_set_current_user( $user_id ); */ $current_user_id = get_current_user_id(); $user_data = get_userdata( $current_user_id ); $user_roles = $user_data->roles; …
When you migrate your site from Joomla to WordPress, it is essential to ensure that you do not lose the SEO value of your existing site. One of the critical steps in this process is to redirect your old site’s URLs to the corresponding pages on your new site. To redirect your existing site links …
I would look in permalink settings in your wp-admin dashboard. That’s where you can alter url structures of your WordPress site including how post urls are determined. I think that’s all you would need depending on your theme.
/* add code in current theme activate in this file functions.php */ add_action( ‘template_redirect’, function() { if( ( !is_page(‘login’) ) ) { if (!is_user_logged_in() ) { wp_redirect( site_url( ‘/login’ ) ); // Example : login page exit(); } } });
After migration index page still redirects to old url