wp_redirect() is not working

Add ob_start(); at the top of functions.php file and remove from your code.
As WP is a combination of plugin and core files and we don’t know which code sends the throws the header sent warning. And we know that functions.php is called every time we made a request to server, so this is the ideal place to add the ob_start() code to overcome the problem.

error code: 523