下面是另一个不区分大小写的短码的简单想法:
/**
 * Make a shortcode case insensitive via the the_content filter
 *
 * @param string $content
 * @return string $content
 */
function my_case_insensitive_shortcode( $content )
{
    $sc   = \'test\'; // Edit this shortcode name to your needs
    $from = \'[\'. $sc ; 
    $to   = $from;
    if( stristr( $content, $from ) )    
        $content = str_ireplace( $from, $to, $content );
    return $content;
}
add_filter( \'the_content\', \'my_case_insensitive_shortcode\', 10 );
 您也可以使用
preg_replace(), 如果您需要更精确的替换。
示例:
在帖子编辑器中编写此内容
[test id="1"]
[tEsT id="2"]
[TeSt id="3"]
 在
do_shortcode 过滤器优先激活
11:
[test id="1"]
[test id="2"]
[test id="3"]