Searching hook to set cookies before and avoid “headers already sent”

For that I would suggest to use

'init'

hook.

According to codex

This runs after WordPress has finished loading but before any headers are sent

For more details visit codex explantion and examples for this hook;

Codex link.

You can find answer to similar question over here;

How to set custom cookies before output

Leave a Comment