永远消除地球上的“Wordpress”(或至少我们可以影响的一点点)。
原型
capital_P_dangit( string $text )
描述
违反我们的编码标准以获得良好的功能名称。
参数
$text
(string)
(Required)
要修改的文本。
返回值
(string)
修改后的文字。
源文件
路径:wp-includes/formatting.php
<?php
...
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 );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/capital_p_dangit/