私のウェブサイトに「プロフィール」というカテゴリがあります。現在、このカテゴリを「プロフィール」というカスタム投稿タイプに移動しています。
私の問題は、このカスタム投稿タイプのアーカイブページを表示できないことです。URLにアクセスするmywebsite.com/profiles
と、プロファイルカテゴリの投稿の単一の投稿ページに移動します。
に含まhas_archive = true;
れていますfunctions.php
同じWebサイトで行った別の種類のカスタム投稿のアーカイブページを作成するのに問題はなかったので、今回はなぜこれが機能しないのか本当にわかりませんでした。
何かアドバイスをいただければ幸いです。
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 */
}
プロファイルのカテゴリスラッグをプロファイル2のようなものに変更してみてください。
—
Vinod Dalvi 2013年
動作しないようです。また、404ページに移動する代わりに、たとえばmywebsite.com/hisというURLにアクセスした場合(「His」と呼ばれるページや投稿はありません)、「his」で始まる投稿に移動します。これはとても奇妙に見えますか?
—
Steie 2013年
パーマリンク構造をもう一度保存しようとしましたか?これにより、書き換えルールが再生成されます。
—
Mike Madern 2013年
パーマリンク設定の[変更を保存]ボタンをクリックして、パーマリンク構造を再度保存してみてください。
—
Vinod Dalvi 2013年