【发布时间】:2014-02-13 10:16:00
【问题描述】:
我设置了一个名为 products 的自定义帖子类型:
add_action( 'init', 'register_cpt_product' );
function register_cpt_product()
{
$labels = array(
'name' => _x( 'products', 'products' ),
'singular_name' => _x( 'product', 'products' ),
'add_new' => _x( 'Add New', 'products' ),
'add_new_item' => _x( 'Add New product', 'products' ),
'edit_item' => _x( 'Edit product', 'products' ),
'new_item' => _x( 'New product', 'products' ),
'view_item' => _x( 'View product', 'products' ),
'search_items' => _x( 'Search products', 'products' ),
'not_found' => _x( 'No products found', 'products' ),
'not_found_in_trash' => _x( 'No products found in Trash', 'products' ),
'parent_item_colon' => _x( 'Parent product:', 'products' ),
'menu_name' => _x( 'products', 'products' ),
);
$args = array(
'labels' => $labels,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'excerpt', 'thumbnail' ),
'taxonomies' => array( 'category', 'post_tag' ),
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'show_in_nav_menus' => true,
'publicly_queryable' => true,
'exclude_from_search' => false,
'has_archive' => true,
'query_var' => true,
'can_export' => true,
'rewrite' => true,
'capability_type' => 'post'
);
register_post_type( 'products', $args );
}
产品与my custom archive page 一起使用。但与类别无关;我只是得到一个“未找到”。
http://drysuits.dannycheeseman.me/category/lights/
我已删除 .htaccess 并重新保存了永久链接.. (/%postname%/)
关于为什么会发生这种情况的任何想法?
【问题讨论】:
标签: php wordpress .htaccess custom-post-type