是通过在注册自定义post类型时设置'public'参数为false来实现的。具体步骤如下:
register_post_type()
函数注册自定义post类型。例如:function custom_post_type() {
$args = array(
'public' => false, // 设置为false,使其不可查询
// 其他参数...
);
register_post_type( 'custom_type', $args );
}
add_action( 'init', 'custom_post_type' );
labels
、supports
、rewrite
等。自定义post类型不可查询的优势是可以隐藏特定类型的内容,使其不在前台展示,仅供插件内部使用。这在需要创建一些仅供插件内部使用的数据或功能时非常有用。
应用场景:
腾讯云相关产品和产品介绍链接地址:
请注意,以上链接仅供参考,具体产品选择应根据实际需求和腾讯云官方文档为准。
没有搜到相关的沙龙
领取专属 10元无门槛券
手把手带您无忧上云