[wp-trac] [WordPress Trac] #34290: Not possible to have a percent symbol contained in the default value of a theme_mod

WordPress Trac noreply at wordpress.org
Sat Apr 21 16:07:59 UTC 2018


#34290: Not possible to have a percent symbol contained in the default value of a
theme_mod
--------------------------+-----------------------------------------
 Reporter:  kuus          |       Owner:  (none)
     Type:  defect (bug)  |      Status:  reopened
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Customize     |     Version:  4.4
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  javascript, administration
--------------------------+-----------------------------------------

Comment (by daviedR):

 Facing the same issue here, my case is:

 `get_theme_mod( 'mykey', '100%' );`

 when `mykey` has no value, the function would return `'100'` instead of
 `'100%'`. The `'%'` character is stripped out because of the `sprintf`
 function.

 In the function description:

   If the modification name does not exist, then the $default will be
 passed through sprintf() PHP function with the first string the template
 directory URI and the second string the stylesheet directory URI.

 Is there any reason why WordPress use sprintf to convert first and second
 `%s` into template and stylesheet directory URI?

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


More information about the wp-trac mailing list