How do you know when to add your action to init or wp_head. In particular with regards to scripts and styles, but also any other action.
Leave a Reply
You must be logged in to post a comment.
How do you know when to add your action to init or wp_head. In particular with regards to scripts and styles, but also any other action.
You must be logged in to post a comment.
From Codex Action Reference:
Basically
wp_head
runs when page is already being loaded, whileinit
runs before that.Also don’t forget that
init
fires on admin pages as well and anything front-end related must be excluded from there with!is_admin()
check.