Skip to content

Instantly share code, notes, and snippets.

@n8finch
Created November 1, 2021 15:11
Show Gist options
  • Save n8finch/f4d83e73b97c8a2a93c1643a9d46cc33 to your computer and use it in GitHub Desktop.
Save n8finch/f4d83e73b97c8a2a93c1643a9d46cc33 to your computer and use it in GitHub Desktop.
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