diff --git a/projects/plugins/wpcomsh/changelog/DOTTHEM-343-footer-credit b/projects/plugins/wpcomsh/changelog/DOTTHEM-343-footer-credit new file mode 100644 index 000000000000..fbd84fadfc65 --- /dev/null +++ b/projects/plugins/wpcomsh/changelog/DOTTHEM-343-footer-credit @@ -0,0 +1,4 @@ +Significance: patch +Type: fixed + +Added word boundary to prevent replacing first instance of the word theme with an empty string when a theme doesn't have a valid style.css diff --git a/projects/plugins/wpcomsh/footer-credit/footer-credit-optimizations.php b/projects/plugins/wpcomsh/footer-credit/footer-credit-optimizations.php index 2d4eec64fc22..801bc25d6052 100644 --- a/projects/plugins/wpcomsh/footer-credit/footer-credit-optimizations.php +++ b/projects/plugins/wpcomsh/footer-credit/footer-credit-optimizations.php @@ -126,7 +126,7 @@ function wpcom_better_footer_links( $footer ) { $theme_regex = array( '(?:\s*\|\s*)?', // Optional pipe with spaces (non-capturing) '(?:]+>)?', // Optional opening span tag (non-capturing) - '(Theme|%s)', // $1: "Theme" or the localized equivalent + '(\bTheme\b|%s)', // $1: "Theme" or the localized equivalent (word boundaries prevent partial match) '\s*(?: )?:?\s*', // Zero or more whitespace characters, an optional colon, zero or more whitespace characters '(%s|]+>%s)', // $2: The theme name, or link '\.?', // Optional period