你最好不要禁用那些操作(你说的)。而是插入add_filter(\'the_content\', \'MyFilter\', 88 );
并创建这样的功能:
function MyFilter($content){
$tags = array( \'p\', \'span\');
///////////////////////////////////////////////////
///////// HERE INSERT ANY OF BELOW CODE //////////
///////////////////////////////////////////////////
return $content;
}
方法1=========
$content= preg_replace( \'#<(\' . implode( \'|\', $tags) . \')(.*|)?>#si\', \'\', $content);
$content= preg_replace( \'#<\\/(\' . implode( \'|\', $tags) . \')>#si\', \'\', $content);
方法2======
foreach ($tags as $tag) {
$content= preg_replace(\'#<\\s*\' . $tag . \'[^>]*>.*?<\\s*/\\s*\'. $tag . \'>#msi\', \'\', $content);
}
方法3=========
DOM 对象(首选):
https://stackoverflow.com/a/31380542/2377343