Question about proper use of wp_redirect?

It seems this would just be a function of your theme. If you don’t provide links to single posts, categories, etc., then as far as your visitors are concerned, those things effectively don’t exist. If you really want to prevent access to things, you can’t redirect in a template as headers have already been sent. … Read more

how to use wp_redirect inside a function

You do not get that error because it runs inside a function, but because the headers have already been send. This means your server already has send some information about the page to the client, thus is it unable to change it’s headers (headers are the first thing that gets send). This mostly happens after … Read more