mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 14:20:15 +00:00
Themes: In get_theme_mod(), only run the sprintf() replacement on the default value if there's a string format pattern found in the value.
This prevents standalone percent symbols from being stripped out, e.g. in a default value like `100%`. Props aristath, kuus, moonomo, westonruter, davetgreen, daviedR, katielgc, noisysocks, SergeyBiryukov. Fixes #34290. git-svn-id: https://develop.svn.wordpress.org/trunk@46395 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -934,7 +934,10 @@ function get_theme_mod( $name, $default = false ) {
|
||||
}
|
||||
|
||||
if ( is_string( $default ) ) {
|
||||
$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
// Only run the replacement if an sprintf() string format pattern was found.
|
||||
if ( preg_match( '#(?<!%)%(?:\d+\$?)?s#', $default ) ) {
|
||||
$default = sprintf( $default, get_template_directory_uri(), get_stylesheet_directory_uri() );
|
||||
}
|
||||
}
|
||||
|
||||
/** This filter is documented in wp-includes/theme.php */
|
||||
|
||||
Reference in New Issue
Block a user