Custom Post Permalinks
-
I only speak very little English.
I have just registered new custom post type (blog), connected custom taxonomy (mycat) with it. I try to force to display new custom post type on custom permalinks.
add_action('init', 'post_type_theme'); function post_type_theme() { $labels = array( 'name' => 'Блог', 'singular_name' => 'Блог', 'add_new' => 'Добавить запись', 'add_new_item' => 'Добавить новую запись', 'edit_item' => 'Редактировать запись', 'new_item' => 'Новая запись', 'view_item' => 'Смотреть запись', 'search_items' => 'Поиск по блогу', 'not_found' => 'Записей не найдено', 'not_found_in_trash' => 'Записей в корзине не найдено', 'parent_item_colon' => '' ); $args = array( 'labels' => $labels, 'public' => true, 'publicly_queryable' => true, 'show_ui' => true, 'query_var' => true, 'rewrite' => array('slug'=>'blog', 'with_front' => false), 'capability_type' => 'post', 'hierarchical' => false, 'menu_position' => 5, 'supports' => array('title','editor','author','thumbnail','excerpt','comments','custom-fields','trackbacks'), ); register_post_type('blog', $args); //flush_rewrite_rules(); $taxlabrl = array( 'name' => 'Тэги', 'singular_name' => 'Тэг', 'search_items' => 'Поиск тэгов', 'all_items' => 'Все тэги', 'add_new_item' => 'Добавить новый тэг', 'new_item_name' => 'Имя нового тэга', 'edit_item'=> 'Редактировать тэг', 'add_or_remove_items' => 'Добавить или удалить тэг', ); $taxargs = array( 'labels' => $taxlabrl, 'public' => true, 'show_ui' => true, 'hierarchical' => true, 'show_tagcloud' => true, 'rewrite' => array('slug' => 'mycat', 'with_front' => false), 'query_var' => true ); register_taxonomy('mycat', 'blog', $taxargs); }URL records look like – site/blog / % postname %
It is necessary that they looked like – site/blog / % mycat % / % postname %. php
How it to make?Permalinks links can be changed by means of plugin Custom Post Permalinks.
/%post_type%/%mycat%/%blog%.php
or
/blog/%mycat%/%blog%.phpBut such references return 404 (Not Found).
The topic ‘Custom Post Permalinks’ is closed to new replies.