REGISTER_TASTIONY-在管理菜单中显示,但不在POST类型(编辑)屏幕上显示

时间:2012-08-10 作者:kaiser

到目前为止,我已经尝试了很多事情,并对核心进行了彻底的调查,但找不到一种方法可以让我add the submenu item, 但是doesn\'t add the meta box 用于自定义分类法。

菜单项

// From: ~/wp-admin/menu.php
// That is the file that builds the menu and submenu entries.
// This is the part, where it adds the submenu items for taxonomies.
// This gets repeated for every (custom) post type menu entry.
$i = 15;
foreach ( get_taxonomies( array(), \'objects\' ) as $tax ) {
    if ( ! $tax->show_ui || ! in_array(\'post\', (array) $tax->object_type, true) )
        continue;

    $submenu[\'edit.php\'][$i++] = array( esc_attr( $tax->labels->menu_name ), $tax->cap->manage_terms, \'edit-tags.php?taxonomy=\' . $tax->name );
}
unset($tax);
元数据框
// From: ~/wp-admin/edit-form-advanced.php
// That is the file, that shows the content of a post type "edit" screen
// all taxonomies. Here it adds some meta boxes for taxonomies
foreach ( get_object_taxonomies($post_type) as $tax_name ) {
    $taxonomy = get_taxonomy($tax_name);
    if ( ! $taxonomy->show_ui )
        continue;

    $label = $taxonomy->labels->name;

    if ( !is_taxonomy_hierarchical($tax_name) )
        add_meta_box(\'tagsdiv-\' . $tax_name, $label, \'post_tags_meta_box\', null, \'side\', \'core\', array( \'taxonomy\' => $tax_name ));
    else
        add_meta_box($tax_name . \'div\', $label, \'post_categories_meta_box\', null, \'side\', \'core\', array( \'taxonomy\' => $tax_name ));
}
Thepublic 参数似乎只影响查询。我能看到的唯一的因素是,添加菜单项和元框,这两者都是由show_ui 论点

请证明我错了。谢谢

1 个回复
最合适的回答,由SO网友:Wyck 整理而成

根据le注释。

function remove_artist_meta() {
    remove_meta_box( \'{taxonomy name}\', \'post\', \'side\' );
}

add_action( \'admin_menu\' , \'remove_artist_meta\' );
管理菜单总是很难处理,这里的一些帮助会很好:http://core.trac.wordpress.org/ticket/12718

但我认为这可以添加一个参数register_taxonomy.http://core.trac.wordpress.org/ticket/21543

结束

相关推荐

使用wp_EDITOR发布自定义metabox文本区域

我是一个新手,希望将wp\\U编辑器添加到自定义的metabox textarea字段中。我似乎到处都在寻找使用wp\\U编辑器编写带有文本区域的元盒的完整示例。我正在寻找一个完整的从头到尾的例子。我不想使用插件。有人有完整示例的链接吗?谢谢