On my website I want to make a custom post type and several taxonomies. I have tried to code the following:
Post type: trabajo
if ( ! function_exists('set_custom_post') ) {
// Register Custom Post Type
function set_custom_post() {
$rewrite = array(
'slug' => 'trabajo',
'with_front' => true,
'pages' => true,
'feeds' => true,
);
$args = array(
'label' => __( 'Trabajo', 'text_domain' ),
'description' => __( 'Trabajos realizados en Peces Gordos Studios S.L', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'revisions', 'post-formats' ),
'taxonomies' => array( 'categoria_trabajo', 'etiqueta_trabajo' ),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 5,
'menu_icon' => 'dashicons-art',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => 'archivo-trabajos',
'exclude_from_search' => false,
'publicly_queryable' => true,
'query_var' => 'trabajo',
'rewrite' => $rewrite,
'capability_type' => 'page',
);
register_post_type( 'trabajo', $args );
}
add_action( 'init', 'set_custom_post', 0 );
}
Taxonomy categoria_trabajo:
if ( function_exists( 'categoria_trabajo' ) ) {
// Register Custom Taxonomy
function categoria_trabajo() {
$args = array(
'labels' => $labels,
'hierarchical' => true,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => false,
'query_var' => 'categoria',
'rewrite' => $rewrite,
'capabilities' => $capabilities,
);
register_taxonomy( 'categoria_trabajo', array( 'trabajo' ), $args );
}
add_action( 'init', 'categoria_trabajo', 0 );
}
Taxonomy etiqueta_trabajo
if ( function_exists( 'etiqueta_trabajo' ) ) {
// Register Custom Taxonomy
function etiqueta_trabajo() {
$args = array(
'labels' => $labels,
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'show_tagcloud' => false,
'query_var' => 'etiqueta',
'rewrite' => $rewrite,
'capabilities' => $capabilities,
);
register_taxonomy( 'etiqueta_trabajo', array( 'trabajo' ), $args );
}
add_action( 'init', 'etiqueta_trabajo', 0 );
}
The custom post type appears in the administrator menu but the linked taxonomies do not appear.
I have compared the code with other source codes and I have not been able to find a solution.
I appreciate any help.