Support Forum
Hello,
I created the custom taxonomy 'Workplace' using MB AIO builder. The custom taxonomy was registered and displayed in the classic post editor, menu and post admin column.
Note: It does not work in the Gutenberg editor of WordPress, even if 'show_in_rest' is set to true.
I used the custom field 'taxonomy' to show the new taxonomy 'workplace'. But the taxonomy field does not show the taxonomy 'workplace'.
<?php
add_action( 'init', 'your_prefix_register_taxonomy' );
function your_prefix_register_taxonomy() {
$labels = [
'name' => esc_html__( 'workplaces', 'your-textdomain' ),
'singular_name' => esc_html__( 'workplace', 'your-textdomain' ),
'menu_name' => esc_html__( 'Workplaces', 'your-textdomain' ),
'search_items' => esc_html__( 'Search workplaces', 'your-textdomain' ),
'popular_items' => esc_html__( 'Popular workplaces', 'your-textdomain' ),
'all_items' => esc_html__( 'All workplaces', 'your-textdomain' ),
'parent_item' => esc_html__( 'Parent workplace', 'your-textdomain' ),
'parent_item_colon' => esc_html__( 'Parent workplace', 'your-textdomain' ),
'edit_item' => esc_html__( 'Edit workplace', 'your-textdomain' ),
'view_item' => esc_html__( 'View workplace', 'your-textdomain' ),
'update_item' => esc_html__( 'Update workplace', 'your-textdomain' ),
'add_new_item' => esc_html__( 'Add new workplace', 'your-textdomain' ),
'new_item_name' => esc_html__( 'New workplace name', 'your-textdomain' ),
'separate_items_with_commas' => esc_html__( 'Separate workplaces with commas', 'your-textdomain' ),
'add_or_remove_items' => esc_html__( 'Add or remove workplaces', 'your-textdomain' ),
'choose_from_most_used' => esc_html__( 'Choose most used workplaces', 'your-textdomain' ),
'not_found' => esc_html__( 'No workplaces found', 'your-textdomain' ),
'no_terms' => esc_html__( 'No workplaces', 'your-textdomain' ),
'filter_by_item' => esc_html__( 'Filter by workplace', 'your-textdomain' ),
'items_list_navigation' => esc_html__( 'Workplaces list pagination', 'your-textdomain' ),
'items_list' => esc_html__( 'Workplaces list', 'your-textdomain' ),
'most_used' => esc_html__( 'Most Used', 'your-textdomain' ),
'back_to_items' => esc_html__( 'Back to workplaces', 'your-textdomain' ),
'text_domain' => esc_html__( 'your-textdomain', 'your-textdomain' ),
];
$args = [
'label' => esc_html__( 'Workplaces', 'your-textdomain' ),
'labels' => $labels,
'description' => 'Workplaces is intended to represent the research institutions, universities, departments, research units and laboratories that offer academic positions.',
'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' => false,
'hierarchical' => true,
],
];
register_taxonomy( 'workplace', ['post', 'page', 'project', 'scholars', 'emp', 'job'], $args );
}
To find out, I tested in troubleshooting mode with the default theme twenty twenty without any other plugins. But the same problem.
Help me to solve the problem.