wp php redirect my account page url to custom url

Step 1: Open your theme's functions.php file. Step 2: Add the following code to the functions.php file to redirect the 'my-account' page to a custom URL:

function custom_my_account_redirect() {
    if ( is_user_logged_in() && is_page( 'my-account' ) ) {
        wp_redirect( 'http://www.yourcustomurl.com' );
        exit;
    }
}
add_action( 'template_redirect', 'custom_my_account_redirect' );

Step 3: Save the changes to the functions.php file. Step 4: Test the redirection by logging in and visiting the 'my-account' page.