New answers tagged


To add one more to the list for logout: add_action('wp_logout','go_home'); function go_home(){ wp_redirect( home_url() ); exit(); }


I think that this native function will help you: if ( is_single() ) { //do stuff } You will find more information in the WP developers section. It works for any post type, except attachments and pages.


You can use register_new_user hook which is the last hook before WordPress perform the redirect to check your email page. In the callback function you will get user ID, using it get the user data and check if user belongs to specific role. Example:- function wpse_228545_register_redirect( $user_id ) { $user_data = get_userdata($user_id); //Get the ...

Top 50 recent answers are included