2013-10-23 39 views
3

當它處於自定義帖子類型時,我無法預覽帖子。如果我在列出所有帖子的頁面上並按下預覽按鈕,那麼運行正常。但是當我進入帖子並點擊「預覽更改」按鈕時,我收到一個404錯誤頁面。在自定義帖子類型上打開的Wordpress預覽

我已經更新並保存了固定鏈接。我將帖子類型設置爲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%/ 

有沒有人有什麼建議?

回答

3

我把args數組中的'post-formats'。這解決了這個問題。 WordPress正在尋找帖子格式,我沒有在我的自定義帖子類型中創建它們。

相關問題