WordPress移除已存在的分类

WordPress移除已存在的分类

/**
 * Remove already registered taxonomy from an object
 * In other words, remove the default Tags from the Posts post_type
 *
 * You can use this for either tags or categories, but the former seems more logical, hence default
 *
 * @source: //stackoverflow.com/a/26260657/1381553
 * @source: //developer.wordpress.org/reference/functions/unregister_taxonomy_for_object_type/
 */
add_action( 'init', 'so_unregister_taxonomy' );
function so_unregister_taxonomy() {
    unregister_taxonomy_for_object_type( 'post_tag', 'post' );
}

发表评论

电子邮件地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据