Answer the question
In order to leave comments, you need to log in
How to change url for custom type in wordpress?
Hello, I tried a bunch of options, but I can't get it to work the way I want.
There is a custom type and a custom taxonomy made through the Custom Post Type UI.
We need links of the form:
site/taxonomy
site/taxonomy/post
or at least
site/type/taxonomy <- this option works
site/type/taxonomy/post <- this one is not
after all the manipulations took this form
//тип
$args = [
"labels" => $labels,
"public" => true,
"publicly_queryable" => true,
"show_ui" => true,
"show_in_rest" => true,
"rest_base" => "",
"rest_controller_class" => "WP_REST_Posts_Controller",
"has_archive" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"delete_with_user" => false,
"exclude_from_search" => false,
"capability_type" => "post",
"map_meta_cap" => true,
"hierarchical" => false,
"rewrite" => [ "slug" => "service", "with_front" => false ],
"query_var" => true,
"taxonomies" => [ "service_taxonomy" ],
"show_in_graphql" => false,
];
//таксономия
$args = [
"public" => true,
"publicly_queryable" => true,
"hierarchical" => true,
"show_ui" => true,
"show_in_menu" => true,
"show_in_nav_menus" => true,
"query_var" => true,
"rewrite" => [ 'slug' => 'service', 'with_front' => false, ],
"show_admin_column" => false,
"show_in_rest" => true,
"rest_base" => "service_taxonomy",
"rest_controller_class" => "WP_REST_Terms_Controller",
"show_in_quick_edit" => false,
"show_in_graphql" => false,
];
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question