是否可以在何时执行之前从内容中删除图库短代码the_content()
?我搜索了 codex 并找到了remove_shortcode( $tag )
,但它们没有显示任何示例。
我尝试添加功能
function remove_gallery($content) {
$content .= remove_shortcode('[gallery]');
return $content;
}
add_filter( 'the_content', 'remove_gallery', 6);
它不起作用..
更新:
我可以使用下面的代码取消注册短代码,但它也会删除内容
function remove_gallery($content) {
return remove_shortcode('gallery', $content);
}
add_filter( 'the_content', 'remove_gallery', 6);