我正在寻找一个php函数(非jQuery或wpautop修改)的方法,来删除wordpress中的<p></p>
标签。
我尝试了这个方法,但它不起作用:
function cleanup_shortcode_fix($content) {
$array = array (
'<p>[' => '[',
']</p>' => ']',
']<br />' => ']',
']<br>' => ']'
);
$content = strtr($content, $array);
return $content;
}
add_filter('the_content', 'cleanup_shortcode_fix');
has_shortcode
函数可以解决这个问题。 - luukvhoudtadd_filter('the_content', 'cleanup_shortcode_fix',10,1);
,上面的代码对我有效。 - LBF