Created
November 1, 2021 15:11
-
-
Save n8finch/f4d83e73b97c8a2a93c1643a9d46cc33 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function capital_P_dangit( $text ) { | |
// Simple replacement for titles. | |
$current_filter = current_filter(); | |
if ( 'the_title' === $current_filter || 'wp_title' === $current_filter ) { | |
return str_replace( 'Wordpress', 'WordPress', $text ); | |
} | |
// Still here? Use the more judicious replacement. | |
static $dblq = false; | |
if ( false === $dblq ) { | |
$dblq = _x( '“', 'opening curly double quote' ); | |
} | |
return str_replace( | |
array( ' Wordpress', '‘Wordpress', $dblq . 'Wordpress', '>Wordpress', '(Wordpress' ), | |
array( ' WordPress', '‘WordPress', $dblq . 'WordPress', '>WordPress', '(WordPress' ), | |
$text | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment