[wp-trac] [WordPress Trac] #30084: Theme Customizer seems to bypass all other hooks
WordPress Trac
noreply at wordpress.org
Thu Nov 20 15:00:59 UTC 2014
#30084: Theme Customizer seems to bypass all other hooks
--------------------------------+------------------------------
Reporter: usability.idealist | Owner:
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Customize | Version: 4.0
Severity: normal | Resolution:
Keywords: reporter-feedback | Focuses: docs
--------------------------------+------------------------------
Comment (by usability.idealist):
Replying to [comment:1 ocean90]:
> I don't understand your issue, can you please explain it further? Maybe
add some code examples (and not the whole theme)?
Sorry, bit too much work these days.
So. I've implemented a Color Scheme system, which is being enhanced with
plugins. This is basically a class with some supplementing functions
(mostly wrappers). It's initialized using a seperate hook:
https://github.com/Themekraft/Custom-
Community/blob/v2.0.10/includes/schemes/libs/color-schemes.class.php#L213
.. which in itself is hooked, or was hooked, to "after_setup_theme":
https://github.com/Themekraft/Custom-
Community/blob/v2.0.10/functions.php#L494
Now comes the big fat BUT: It's supplementary functions are also being
used inside the Customizer call - and are supposed to work flawlessy ..
But then I noticed that the initialization of the base class somehow
failed.
So I tried out several hooks, starting from '''init''', '''admin_init''',
up to the Customizer init hook itself, even trying out a partial rewrite
so the Color Scheme class gets initialized directly (leading to a whole
iota of other issues) ..
... but, no matter which hook I chose, how hard I tried - it didn't
initialize.
So to handle this issue, I created a pretty nasty piece of work-around:
Using a global object and test in every place whether it's already set or
not - and in the latter case, initializing the class again. Which
'''somehow''' works, but well .. it's not reliable enhanceable anymore. I
ironed out most issues, including an issue with the theme class being
initialized before the plugin (extending) class (!), sometimes partially
reinventing the wheel.
cu, w0lf.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/30084#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list