ฉันมีหมวดหมู่บนเว็บไซต์ของฉันที่เรียกว่า 'โปรไฟล์' ฉันอยู่ในขั้นตอนการย้ายหมวดหมู่นี้ไปยังประเภทโพสต์ที่กำหนดเองที่เรียกว่า 'โปรไฟล์'
ปัญหาของฉันคือฉันไม่สามารถรับหน้าเก็บถาวรสำหรับประเภทโพสต์ที่กำหนดเองนี้ เมื่อฉันไปที่ URL mywebsite.com/profiles
มันจะพาฉันไปยังหน้าโพสต์เดียวสำหรับโพสต์ในหมวดหมู่โปรไฟล์
ฉันรวมอยู่has_archive = true;
ในfunctions.php
ฉันไม่มีปัญหาในการสร้างหน้าเก็บถาวรสำหรับโพสต์แบบกำหนดเองประเภทอื่นที่ฉันทำในเว็บไซต์เดียวกันดังนั้นฉันจึงหลงทางจริงๆว่าทำไมนี่จึงใช้งานไม่ได้ในครั้งนี้
คำแนะนำใด ๆ ที่จะได้รับการชื่นชมมากที่สุด?
add_action( 'init', 'profile_custom_init' );
/* Here's how to create your customized labels */
function profile_custom_init() {
$labels = array(
'name' => _x( 'Profiles', 'post type general name' ), // Tip: _x('') is used for localization
'singular_name' => _x( 'Profile', 'post type singular name' ),
'add_new' => _x( 'Add New', 'Profile' ),
'add_new_item' => __( 'Add Profile' ),
'edit_item' => __( 'Edit Profile' ),
'new_item' => __( 'New Profile' ),
'view_item' => __( 'View Profile' ),
'search_items' => __( 'Search Profile' ),
'not_found' => __( 'No Profile found' ),
'not_found_in_trash' => __( 'No Profile found in Trash' ),
'parent_item_colon' => ''
);
// Create an array for the $args
$args = array( 'labels' => $labels, /* NOTICE: the $labels variable is used here... */
'public' => true,
'publicly_queryable' => true,
'has_archive' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => true,
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 10,
'supports' => array( 'title', 'editor','thumbnail', 'excerpt', 'custom-fields' ),
'taxonomies' => array('category')
);
register_post_type( 'profile', $args ); /* Register it and move on */
}