Custom post_types and taxonomy slugs
-
Hello.
I used custom post types for new posts, and add to them as separate categories, it looks like this –add_action('init', 'rooms_register'); function rooms_register() { $labels = array( ......... ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'hierarchical' => false, 'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/rooms-admin.png', 'rewrite' => array( 'slug' => 'rooms', 'with_front' => true ), 'capability_type' => 'post', 'taxonomies' => array('postname', 'rooms_categories'), // 'taxonomies' => array('post_name', 'category'), 'menu_position' => null, 'supports' => array('title', 'editor') ); register_post_type( 'rooms' , $args ); } register_taxonomy('rooms_categories', array('rooms'), array( 'hierarchical' => true, 'label' => 'Категории', 'singular_label' => 'category', 'rewrite' => array( 'slug' => 'rooms', 'with_front' => false ), )); .......
After that url to be obtained in this category –
test.com/rooms/category-name
And for the post –
test.com/rooms/post-name
How to add the category name into the url of post ? I need something like this –
test.com/rooms/category-name/post-namePlease help solve the problem
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Custom post_types and taxonomy slugs’ is closed to new replies.