Php Wordpress 4.1:自定义帖子类型赢得';t加载,链接不';行不通

Php Wordpress 4.1:自定义帖子类型赢得';t加载,链接不';行不通,php,wordpress,custom-post-type,Php,Wordpress,Custom Post Type,我已注册一个自定义邮件类型: <?php register_post_type( 'my_cpt_fiction', array( 'labels' => array( 'name' => __( 'Custom Posts' ) , 'singular_name' => __( 'Custom Post' ) , 'add_new' => 'Add New' , 'add_new_item' =>

我已注册一个自定义邮件类型:

<?php
register_post_type( 'my_cpt_fiction',
  array(
    'labels' => array(
        'name' => __( 'Custom Posts' )
      , 'singular_name' => __( 'Custom Post' )
      , 'add_new' => 'Add New'
      , 'add_new_item' => 'Create a new Custom Post'
      , 'edit' => 'Edit Custom Post'
      , 'edit_item' => 'Edit Custom Post'
      , 'new_item' => 'Create a new Custom Post,'
      , 'view_item' => 'View Custom Post,'
      , 'search_items' => 'Search Custom Post'
      , 'not_found' => 'No Custom Posts found'
      , 'not_found_in_trash' => 'No Custom Posts found in trash'
    ),
      'public' => true
    , 'has_archive' => true

    , 'supports' => Array(
        'title' => 'title'
      , 'editor' => 'editor'
      , 'author' => 'author'
      , 'comments' => 'comments'
    )
    , 'show_ui'             => true
    , 'rewrite' => array( 'slug' =>  'my_custom_post' , 'with_front' => false, 'feeds' => true )
    , 'capability_type'    => array('my_custom_post','my_custom_posts')
    , 'map_meta_cap'        => true
    , 'taxonomies' => array('category')
    , 'publicly_queryable'  => true
    , 'exclude_from_search' => false
    , 'query_var'          => true
  )
);

尝试将其包装在init hook中:

add_action( 'init', 'create_my_post_type' );
function create_my_post_type() {
    // Your code here
}

创建帖子类型或更改其重写设置后,请转到wordpress设置->永久链接,然后单击保存。这将重置重写规则并重新创建.htaccess文件。

尝试将其包装到init hook中:

add_action( 'init', 'create_my_post_type' );
function create_my_post_type() {
    // Your code here
}

创建帖子类型或更改其重写设置后,请转到wordpress设置->永久链接,然后单击保存。这将重置您的重写规则并重新创建.htaccess文件。

由于WordPress的重写规则,大多数情况下都会发生这种情况,它们存储在数据库中,您需要刷新它们


转到“设置-永久链接”,只需单击“保存”,即可启动刷新重写规则。

由于WordPress的重写规则,大多数情况下都会发生这种情况,它们存储在数据库中,您需要刷新它们

转到“设置-永久链接”,只需单击“保存”,即可启动刷新重写规则