WordPress若想在指定文章中不显示短代码,可以按追格小编的方法操作。
function remove_shortcode_from_index( $content ) {
if ( is_single( array( 888 ) ) ) {
$content = strip_shortcodes( $content );
}
return $content;
}
add_filter( 'the_content', 'remove_shortcode_from_index' );
方法:在当前WordPress主题的 functions.php 文件中插入上面这段代码即可。
ps:888为文章id,按需修改即可。
-
WordPress函数:wp_update_post 更新修改文章WordPress函数:wp_update_post 更新修改文章
-
WordPress函数:wp_trash_post_comments 移动文章评论到垃圾站WordPress函数:wp_trash_post_comments 移动文章评论到垃圾站
-
WordPress函数:wp_delete_attachment 删除附件WordPress函数:wp_delete_attachment 删除评论
-
WordPress函数:wp_update_user 更新用户信息WordPress函数:wp_update_user 更新用户信息
-
WordPress函数:add_shortcode 添加短代码WordPress函数:add_shortcode 添加短代码
-
WordPress函数:remove_shortcode 删除短代码WordPress函数:remove_shortcode 删除短代码
暂无评论,抢个沙发...