WordPress文章编辑中出现字符“&”会被自动转义为“& ;” 例如链接url中带有&,被转义后,会导致网站链接打不开,新手站长xinshouzhanzhang.com分享给大家,只要在functions.php中添加禁止转义代码即可:
禁止WordPress自动转义符号
// 禁止转义符号
add_filter( 'the_content', function( $string ) {
return preg_replace_callback( '|<a\b([^>]*)>(.*?)</a>|', function( $matches ) {
return '<a' . str_replace( '&', '&', $matches[1] ) . '>' . $matches[2] . '</a>';
}, $string );
}, 10, 1 );
阿里云官方活动:https://t.aliyun.com/U/FzmsXA
腾讯云官方活动:https://curl.qcloud.com/oRMoSucP
