如何从 Wordpress 中删除分类法? [英] How do I remove a taxonomy from Wordpress?

查看:29
本文介绍了如何从 Wordpress 中删除分类法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建不同的自定义帖子类型和分类法,我想从默认的帖子"帖子类型中删除帖子标签"分类法.我该怎么做?

I'm creating different custom post types and taxonomies and I want to remove the 'Post Tags' taxonomy from the default 'Posts' post type. How do I go about doing this?

谢谢.

推荐答案

我建议你不要搞乱实际的全局.简单地从帖子类型中取消注册分类法更安全: register_taxonomy 用于创建和修改.

I suggest you don't mess with the actual global. Its safer to simply deregister the taxonomy from the post type: register_taxonomy is used for both creation and modification.

function ev_unregister_taxonomy(){
    register_taxonomy('post_tag', array());
}
add_action('init', 'ev_unregister_taxonomy');

要删除侧边栏菜单项:

// Remove menu
function remove_menus(){
    remove_menu_page('edit-tags.php?taxonomy=post_tag'); // Post tags
}

add_action( 'admin_menu', 'remove_menus' );

这篇关于如何从 Wordpress 中删除分类法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆