是否有可能在执行the_content()
之前从内容中删除图库短代码?我搜查了codex,发现remove_shortcode($tag)
,但它们没有显示任何示例。Wordpress从内容中删除短代码
我尝试添加到功能
function remove_gallery($content) {
$content .= remove_shortcode('[gallery]');
return $content;
}
add_filter('the_content', 'remove_gallery', 6);
它不工作..
更新:
我可以使用下面的代码来注销短代码,但它也消除了content
function remove_gallery($content) {
return remove_shortcode('gallery', $content);
}
add_filter('the_content', 'remove_gallery', 6);
谢谢!我没有返回内容。如果你可以指定要删除的短代码,'strip_shortcodes()'是最理想的。 – CyberJunkie 2011-12-18 05:51:00