Load template/stylesheet defines after locale
|Reported by:||casualgenius||Owned by:|
I write a plugin that lets site owners have different categories served up as subdomains. One of the main features is you can pick different themes for the different subdomain categories. This all worked fairly well until wordpress 2.8 was released.
My plugin uses get_categories to find a list of all categories. In 2.8 you moved the creation of default taxonomies into a function (create_initial_taxonomies) that is run by the "init" action hook. However my plugin needs to use the get_categories function before init.
I know it's been said that plugins shouldn't actually do anything before init (as mentioned here #9647). However, the Template and Stylesheet functions are loaded before init. Therefore I have to do something with the categories prior to init because I need to have filters for "pre_option_template" and "pre_option_stylesheet" ready to supply the new template/stylesheet path should it need to.
I know I could just write some custom SQL to get the data I need and discard get_categories. I've already had to do this for fetching the list of authors on the site (plugin supports subdomain by author too). But really I'd rather use the available wordpress API.
I'm sorry if this has been a very long winded way of reaching my question, which is:
Can the define of the TEMPLATEPATH and STYLESHEETPATH and subsequent loading of theme functions (should they exist) be done after init rather than before?
Change History (6)
- Keywords 2nd-opinion added
- Milestone changed from Unassigned to 2.9
- Summary changed from Load template/stylesheet functions later after init to Load template/stylesheet defines after locale
- Milestone 2.9 deleted
- Resolution set to duplicate
- Status changed from new to closed