I have created a custom post of type "job". I created taxonomies. I would like the urls to be done like this.
examplesite.com/job/categorie/page because for the moment in the url there is only the type of post "job". I did a lot of research I came across various solutions, but without success the pots found in the forums dates from several years and I would like to avoid using a plugin.
Here is my code, in bold I put what I found for the moment on the forums, the most consistent. I’m pretty lost at this level
$labels = array(
'name' => 'Carrière',
'singular_name' => 'Carrière',
'add_new' => 'Ajouter un emploi',
'add_new_item' => 'Ajouter un emploi',
'edit_item' => 'Editer un emploi',
'new_item' => 'Nouvel un emploi',
'all_items' => 'Tous les emplois',
'view_item' => 'Voir emploi',
'search_items' => 'Chercher un emploi',
'not_found' => 'Aucun emploi',
'not_found_in_trash' => 'Aucun emploi trouvé dans la corbeille',
'menu_name' => 'Carrières'
);
$args = array(
'labels' => $labels,
'description' => 'Page détails des emplois',
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
**'rewrite' => array('slug'=>'type-job/%cat_job%'),**
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'menu_icon' => 'dashicons-businessman',
);
register_post_type('job', $args );
$labels = array(
'name' => 'Categories',
'new_item_name' => 'Name cat',
'parent_item' => 'Cat parent',
);
$args = array(
'labels' => $labels,
'hierarchical' => true,
'show_ui' => true,
'show_admin_column' => true,
'public' => true,
**'has_archive' => true,
'rewrite' => array( 'slug' => 'type-job'),**
);
register_taxonomy( 'type-career', 'job', $args );
}
add_action('init', 'cpt'); ```