[wp-trac] [WordPress Trac] #33146: Add optional $name variable to theme_mod_$name Filter.

WordPress Trac noreply at wordpress.org
Mon Jul 27 19:13:05 UTC 2015


#33146: Add optional $name variable to theme_mod_$name Filter.
--------------------------+-----------------------------
 Reporter:  clintstegman  |      Owner:
     Type:  enhancement   |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  Themes        |    Version:  4.2.3
 Severity:  normal        |   Keywords:
  Focuses:  template      |
--------------------------+-----------------------------
 I am making a plugin and using this filter:
 [https://codex.wordpress.org/Plugin_API/Filter_Reference/theme_mod_$name]

 If I could access the name of the Theme Mod when the filter is applied, I
 could remove redundant code.

 The filter is applied in 2 places

 [https://core.trac.wordpress.org/browser/tags/4.2.3/src/wp-
 includes/theme.php#L921]


 {{{
 return apply_filters( "theme_mod_{$name}", $mods[$name] );
 }}}
 $name can be added to the end for optional use
 {{{
 return apply_filters( "theme_mod_{$name}", $mods[$name], $name );
 }}}


 Same change for line 928
 [https://core.trac.wordpress.org/browser/tags/4.2.3/src/wp-
 includes/theme.php#L928]

 {{{
 return apply_filters( "theme_mod_{$name}", $default );
 }}}
 Becomes
 {{{
 return apply_filters( "theme_mod_{$name}", $default, $name );
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/33146>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list