User Registration

Step by step documentation to set up a user registration form for your website.

Log out redirect didn’t work?

If you are using the Log out shortcode along with the logout_redirect parameter like [user_registration_my_account logout_redirect=’page-slug’] in widgets or on pages with page builder, log out redirect might not work. You need to manually add the following codes to your child theme’s functions.php

For this, go to your admin dashboard, and click on Appearances -> Theme Editor. Now, you’ll see the list of files on the right which includes the Theme Functions (functions.php). Click on the functions.php file.

In the functions.php file, simply add the code below:

add_action( 'wp_logout', 'ur_redirect_after_logout');
function ur_redirect_after_logout(){
         wp_redirect( home_url() );
         exit();
}

Adding this code will redirect the users to the homepage. If you want to redirect users to any other page then all you need to do is replace home_url() with the slug of the page you want to redirect.

For example, if you want to redirect to www.example.com/testing then replace home_url() with ‘testing’ and it will do the trick.

Note: Don’t miss the single quote while replacing it with the slug.

Check How to add custom code snippet?

Powered by BetterDocs

Scroll to top