ฉันพบว่าสถานที่นี้เป็นแหล่งข้อมูลที่ดีในอดีตผ่าน Googling มากมายสำหรับปัญหาที่ฉันพบ คำถามของฉันเกี่ยวกับกฎการเขียนซ้ำอย่างละเอียดใช้ WordPress
ฉันได้ตั้งค่าประเภทโพสต์ที่กำหนดเองที่เรียกว่าโครงการและฉันได้ลงทะเบียนอนุกรมวิธานที่กำหนดเองที่เรียกว่าโครงการ ทุกอย่างใช้งานได้ดียกเว้นตัวเลือกกระสุนเขียนใหม่ในขณะที่พวกเขาลงเอยด้วยความขัดแย้ง - น่าจะเกิดจากกฎการเขียนซ้ำ
โดยทั่วไปนี่คือโครงสร้างที่ฉันต้องการบรรลุ:
example.com/work/%taxonomy%/%post_name%/(สำหรับโพสต์)example.com/work/%taxonomy%/(โพสต์รายการที่เป็นของคำเฉพาะอนุกรมวิธาน)example.com/work/(ไปที่ page-work.php ซึ่งรวมถึง taxonomy.php เพื่อแสดงรายการโพสต์ทั้งหมดที่เกี่ยวข้องกับ taxonomy นั้น)
นี่คือรหัสที่ฉันมีมา แต่ฉันต้องการความช่วยเหลือในการเขียนกฎ WP_Rewrite เนื่องจากนี่เป็นบิตที่ฉันนิ่งเงียบเล็กน้อย
$labels = array(
    'name' => _x('Projects', 'post type general name'),
    'singular_name' => _x('Project', 'post type singular name'),
    'add_new' => _x('Add New', 'project item'),
    'add_new_item' => __('Add New Project'),
    'edit_item' => __('Edit Project'),
    'new_item' => __('New Project'),
    'view_item' => __('View Project'),
    'search_items' => __('Search Projects'),
    'not_found' =>  __('Nothing found'),
    'not_found_in_trash' => __('Nothing found in Trash'),
    'parent_item_colon' => ''
);
$args = array(
    'labels' => $labels,
    'public' => true,
    'publicly_queryable' => true,
    'hierarchical' => true,
    'rewrite' => array('slug'=>'work', 'with_front'=>false),
    'show_ui' => true,
    '_builtin' => false, // It's a custom post type, not built in!
    'capability_type' => 'post',
    'query_var' => "project", // This goes to the WP_Query schema
    'menu_position' => null,
    'supports' => array('title','editor','thumbnail', 'comments', 'author', 'excerpt')
);
register_post_type('project' , $args);
// Showcase Taxonomy
register_taxonomy('projects', array('project'), array(
    'public' => true,
    'hierarchical' => true,
    'label' => 'Project Categories', 
    'singular_label' => 'Project Category',
    'query_var' => true,
    'rewrite' => array('slug'=>'work', 'with_front'=>false, 'hierarchical'=>true)
    )
);
ขอบคุณมากสำหรับความช่วยเหลือของคุณ! :-)