From 83edc2476242bebfbe050e3bbf0826cd27b3c8d4 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sat, 5 Oct 2019 00:54:58 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@46395 git-svn-id: http://core.svn.wordpress.org/trunk@46194 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/theme.php | 5 ++++- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 198bf94478..2fb98bcb9d 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -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( '#(?