I am trying to create a function in my topic that relies on doing things before sending headers. So naturally, I hooked the Init hook like this:
add_action('init', 'my_function');
But the problem is that I want my_function to run if the user is not looking at the admin section or login page.
So which hook I can use is only an interface, but is executed before the headers are sent. If you look at the API link , it does not seem to exist, and, obviously, the conditions do not work at the beginning of execution.
So besides finding the URLs / wp-admin / and / wp-login / (which seems awkward to me), I cannot understand.
source
share