Why is wp_redirect() preferable to a standard PHP header redirect?

In asking a question about hooks and redirects, I was advised to use wp_redirect in place of the PHP header function. Just wondering why wp_redirect is preferable?

Related posts

Leave a Reply

2 comments

  1. See the source. It has some additional logic for IIS servers, as well as some hooks. It is also pluggable function, so it might be redefined.

    Overall it’s just more flexible and gives other developers more options to work with your code, unavailable if you just hardcode things.