Opened 4 years ago
Last modified 3 years ago
#54819 new defect (bug)
Adding Taxonomy with word "media" not showing list in Edit/Create Post
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Awaiting Review | Priority: | normal |
| Severity: | normal | Version: | |
| Component: | Taxonomy | Keywords: | |
| Focuses: | Cc: |
Description
Wordpress Version 5.8.3
PHP version 7.4.27 (Supports 64bit values)
<?php
add_action( 'init', 'your_prefix_register_taxonomy' );
function your_prefix_register_taxonomy() {
$labels = [
'name' => esc_html__( 'Media Classes', 'your-textdomain' ),
'singular_name' => esc_html__( 'Media Class', 'your-textdomain' ),
'menu_name' => esc_html__( 'Media Classes', 'your-textdomain' ),
'search_items' => esc_html__( 'Search Media Classes', 'your-textdomain' ),
'popular_items' => esc_html__( 'Popular Media Classes', 'your-textdomain' ),
'all_items' => esc_html__( 'All Media Classes', 'your-textdomain' ),
'parent_item' => esc_html__( 'Parent Media Class', 'your-textdomain' ),
'parent_item_colon' => esc_html__( 'Parent Media Class', 'your-textdomain' ),
'edit_item' => esc_html__( 'Edit Media Class', 'your-textdomain' ),
'view_item' => esc_html__( 'View Media Class', 'your-textdomain' ),
'update_item' => esc_html__( 'Update Media Class', 'your-textdomain' ),
'add_new_item' => esc_html__( 'Add new media class', 'your-textdomain' ),
'new_item_name' => esc_html__( 'New media class name', 'your-textdomain' ),
'separate_items_with_commas' => esc_html__( 'Separate media classes with commas', 'your-textdomain' ),
'add_or_remove_items' => esc_html__( 'Add or remove media classes', 'your-textdomain' ),
'choose_from_most_used' => esc_html__( 'Choose most used media classes', 'your-textdomain' ),
'not_found' => esc_html__( 'No media classes found', 'your-textdomain' ),
'no_terms' => esc_html__( 'No Media Classes', 'your-textdomain' ),
'filter_by_item' => esc_html__( 'Filter by media class', 'your-textdomain' ),
'items_list_navigation' => esc_html__( 'Media classes list pagination', 'your-textdomain' ),
'items_list' => esc_html__( 'Media Classes list', 'your-textdomain' ),
'most_used' => esc_html__( 'Most Used', 'your-textdomain' ),
'back_to_items' => esc_html__( 'Back to media classes', 'your-textdomain' ),
];
$args = [
'label' => esc_html__( 'Media Classes', 'your-textdomain' ),
'labels' => $labels,
'description' => '',
'public' => true,
'publicly_queryable' => true,
'hierarchical' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'show_in_rest' => true,
'show_tagcloud' => true,
'show_in_quick_edit' => true,
'show_admin_column' => true,
'query_var' => true,
'sort' => true,
'meta_box_cb' => 'post_tags_meta_box',
'rest_base' => '',
'rewrite' => [
'with_front' => true,
'hierarchical' => true,
],
];
register_taxonomy( 'media-class', ['post', 'comunidad'], $args );
}
Attachments (2)
Change History (4)
#2
@
3 years ago
I added the code supplied into WP 6.1.1 as a mu-plugin and added the terms ca and cb.
The terms ca and cb were displayed as the user expected.
I had thought that the meta call callback of post_tags_meta_box may be confusing things (since it is a hierarchical taxonomy). Setting it to post_categories_meta_box or removing the callback made no difference.
I then defined the taxonomy to apply to a post type that uses the classic editor. It outputs the post_tags_meta_box as defined. This does not display the potential values. Setting it to post_categories_meta_box or removing the callback outputs the values as expected.
For me, no error found with WP 6.1.
Edit/Create Post. Not showing list of Media Class (Custom Taxonomy)