## wp redirect – wp_redirect is not working sometimes

Question

I’ve tested the following code in my function.php:

if ( \$_GET['test'] ) {

and it works, if I go to https://example.com/?test=true, I will be redirected to Google.
But I found out when I put wp_redirect() in a function hooked to some action, it won’t work. Instead after its execution users will stay on the same page, and, in my case, some CSS files seems not being loaded.