[wp-trac] [WordPress Trac] #14721: set_theme_mod() needs a filter
WordPress Trac
noreply at wordpress.org
Thu Feb 27 15:53:52 UTC 2014
#14721: set_theme_mod() needs a filter
--------------------------+--------------------
Reporter: mikeschinkel | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: 3.9
Component: Themes | Version: 3.0.1
Severity: normal | Resolution:
Keywords: has-patch | Focuses:
--------------------------+--------------------
Comment (by ssmathias):
Replying to [comment:13 MikeHansenMe]:
> Replying to [comment:12 ssmathias]:
> >
> > Using a filter on save can be more performant if something is saved
less frequently than it is read. Running filters does take time, so if it
saves once, or even once a month, versus being read on page load, you can
see how frequently the latter filters would run compared to the former.
>
> So in your situation you are filtering it in order to save it. Why would
you not just update the setting and avoid a filter all together?
In the use case that came up when I first got involved with the ticket, we
actually cared more about an action than a filter. We needed to know when
one theme mod was changed so that we could trigger some setting updates in
another option. My patch added both filters and actions because there may
be a conceivable use case in which someone's custom theme may want to
control the input of these options.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/14721#comment:14>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list