多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
``` function git_esc_html($content) { $regex = '/(<pre\s+[^>]*?class\s*?=\s*?[",\'].*?prettyprint.*?[",\'].*?>)(.*?)(<\/pre>)/sim'; return preg_replace_callback($regex, 'git_esc_callback', $content); } function git_esc_callback($matches) { $tag_open = $matches[1]; $content = $matches[2]; $tag_close = $matches[3]; $content = esc_html($content); return $tag_open . $content . $tag_close; } add_filter('the_content', 'git_esc_html', 2); add_filter('comment_text', 'git_esc_html', 2); ```