[wp-trac] [WordPress Trac] #20027: Use get_(template|stylesheet) instead of get_option( '(template|stylesheet)' )
WordPress Trac
wp-trac at lists.automattic.com
Mon Feb 20 13:57:54 UTC 2012
#20027: Use get_(template|stylesheet) instead of get_option(
'(template|stylesheet)' )
------------------------------+------------------
Reporter: ocean90 | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.4
Component: Themes | Version:
Severity: normal | Resolution:
Keywords: has-patch commit |
------------------------------+------------------
Comment (by westi):
Replying to [comment:4 nacin]:
> Replying to [comment:2 westi]:
> > Should we deprecate the options too?
>
> Can't, as one calls the other.
>
Well we could but the code would be horrible (scanning backtraces on every
call) so yes it isn't feasible.
> I wonder if we should instead have never adopted get_stylesheet() and
get_template(), and then filters could be placed on option_stylesheet and
option_template. We could even maintain compat by applying the existing
'stylesheet' and 'template' filters on a callback for option_stylesheet
and option_template, respectively.
>
> It's not like these are theme template functions. The wrappers aren't
that necessary and they only cause problems when filtering them.
I still think that the non-get_option calls are better ones to recommend
people use and don't think that deprecating get_stylesheet or get_template
is helpful.
I think we should encourage people to use get_stylesheet and get_template
rather than get_option.
But we should make it so that they can't get different results.
The best way to do this is to make some changes to get_option and add some
special cases for these two options for filtering - this is the simplest
way to preserve the filter ordering that we have now (otherwise you have
to guess at the largest priority something is hooked into the option
filter and the filters in the wrapper functions lose out when they
previously won)
--
Ticket URL: <http://core.trac.wordpress.org/ticket/20027#comment:8>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list