カスタム投稿タイプの投稿をプレビューできません。すべての投稿がリストされているページにいて、プレビュー ボタンを押すと、問題なく動作します。しかし、投稿に移動して [変更のプレビュー] ボタンをクリックすると、404 エラー ページが表示されます。
パーマリンクを更新して保存しました。投稿タイプを public_queryable に設定しました。
ブラウザーで Javascript を無効にすると、プレビュー ボタンは機能しますが、これは、望ましくない Wordpress コア ファイルを変更する必要があることを意味します。
これが私のカスタム投稿タイプの構造です:
function my_custom_post_attq() {
$labels = array(
'name' => _x( 'Product' ),
'singular_name' => _x( 'product' ),
'add_new' => _x( 'New product' ),
'add_new_item' => __( 'add product' ),
'edit_item' => __( 'edit product' ),
'new_item' => __( 'new product' ),
'all_items' => __( 'all products' ),
'view_item' => __( 'view product' ),
'search_items' => __( 'search products' ),
'not_found' => __( 'product not found' ),
'not_found_in_trash' => __( 'product not found in trash' ),
'parent_item_colon' => '',
'menu_name' => 'product'
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'attq' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => 8,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'revisions', 'custom-fields', 'post-formats' ),
'taxonomies' => array( 'category', 'post_tag')
);
register_post_type( 'attq', $args );
}
add_action( 'init', 'my_custom_post_attq', 'flush_rewrite_rules' );
私のパーマリンク構造は
/%year%/%monthnum%/%day%/%postname%/
誰か提案はありますか?