'Redirect User After creating a page

I want to redirect the users of my site to a custom thank you page after they create a page and send it for review. I found this snippet, but this one is for posts, and it's for publishing, not for pending review. The role that I want to use for this snippet is Tutor Instructor.

Can somebody help me to edit this snippet? It's a WordPress site.

    add_action( 'save_post', 'redirect_user_page_list', 10, 3 );

function redirect_user_page_list( $post_ID, $post, $update ) {
    
    if( is_user_logged_in() ) {
               $user = wp_get_current_user();
               $role = ( array ) $user->roles;
               if ( 'user_role' == $role[0] ) {
                    $url = '';
                wp_redirect($url);
                exit;
               }
        }
}
//replace user_role with your actual role the one for which you need to implement this functionality. Also place the proper url in $url.


Solution 1:[1]

You can execute this code after your code

window.location.href = 'https://yoursite.com/thank-you';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Ansh Bhatia