This is kind of a general WP Theme coding question.
I have a Child Theme that has a function which enqueue’s its stylesheet and then hooks into the template_redirect hook. This works in most cases, but occasionally a user of such Child Theme runs into instances where this doesn’t work. For example, a Plugin which has Custom Page Templates and styles that hook into template_redirect at a higher priority. In these cases the Child Theme’s stylesheet never gets hooked in (“The Events Calendar” Plugin and I think BBPress does this).
So one solution has been to hook this stylesheet function into the ‘wp’ hook, but I wasn’t sure if this could cause other issues in the future. I know this hook location is after the posts query, but before the template execution so it would seem like an ideal place, but I wasn’t sure if there might be cases where this could be a bad idea.
So my question is, can anyone think of a situation where this might not be ideal or just in general, does this raise any red flags for anybody?
Thanks for any input. 🙂
- The topic ‘Hooking enqueued styles into template_redirect or wp?’ is closed to new replies.