[wp-trac] [WordPress Trac] #14721: set_theme_mod() needs a filter

WordPress Trac noreply at wordpress.org
Thu Feb 27 15:47:06 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:11 MikeHansenMe]:
 > Is there a use case where it is better to filter before saving rather
 than filtering on retrieval? There is a filter in get_theme_mod() on line
 896 that looks like
 >
 > {{{
 > apply_filters( "theme_mod_{$name}", $mods[$name] );
 > }}}
 >
 > I would think that could be used in any situation where the proposed
 filter would be used.

 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.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/14721#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list