Custom log out to home page in wordpress

add this code in theme function file (function.php)

function My_Log_Out() {

    $home =home_url();

    wp_redirect( $home );

    exit;
}

add_action('wp_logout', 'My_Log_Out');