我已经试过刷新我的permalinks,但我仍然不能使它正常工作。
我已经创建了类别movies、gaming、blu-ray和tv,所以我的URL就是site.com/movies/。我想为电影在site.com/movies/post-here/发布一篇文章,所以我的自定义帖子类型是“电影”。
movies类别下的所有普通wordpress包现在都是404,而专门从post类型Movie Posts创建的帖子工作正常。这是正常的吗?有我不包括的步骤吗?
以下是我的所有自定义post类型(使用自定义Post类型UI创建):
//Movies Custom Post Type
register_post_type('movies_cp', array(  'label' => 'Movie Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'movies'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Movie Posts',
  'singular_name' => 'Movie Post',
  'menu_name' => 'Movie Posts',
  'add_new' => 'Add Movie Post',
  'add_new_item' => 'Add New Movie Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Movie Post',
  'new_item' => 'New Movie Post',
  'view' => 'View Movie Post',
  'view_item' => 'View Movie Post',
  'search_items' => 'Search Movie Posts',
  'not_found' => 'No Movie Posts Found',
  'not_found_in_trash' => 'No Movie Posts Found in Trash',
  'parent' => 'Parent Movie Post',
),) );
//Gaming Custom Post Type
register_post_type('gaming_cp', array(  'label' => 'Gaming Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'gaming'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Gaming Posts',
  'singular_name' => 'Gaming Post',
  'menu_name' => 'Gaming Posts',
  'add_new' => 'Add Gaming Post',
  'add_new_item' => 'Add New Gaming Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Gaming Post',
  'new_item' => 'New Gaming Post',
  'view' => 'View Gaming Post',
  'view_item' => 'View Gaming Post',
  'search_items' => 'Search Gaming Posts',
  'not_found' => 'No Gaming Posts Found',
  'not_found_in_trash' => 'No Gaming Posts Found in Trash',
  'parent' => 'Parent Gaming Post',
),) );
//Blu-ray Custom Post Type
register_post_type('blu-ray_cp', array( 'label' => 'Blu-Ray Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'blu-ray'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'Blu-Ray Posts',
  'singular_name' => 'Blu-Ray Post',
  'menu_name' => 'Blu-Ray Posts',
  'add_new' => 'Add Blu-Ray Post',
  'add_new_item' => 'Add New Blu-Ray Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit Blu-Ray Post',
  'new_item' => 'New Blu-Ray Post',
  'view' => 'View Blu-Ray Post',
  'view_item' => 'View Blu-Ray Post',
  'search_items' => 'Search Blu-Ray Posts',
  'not_found' => 'No Blu-Ray Posts Found',
  'not_found_in_trash' => 'No Blu-Ray Posts Found in Trash',
  'parent' => 'Parent Blu-Ray Post',
),) );
//TV Custom Post Type
register_post_type('tv_cp', array(  'label' => 'TV Posts','description' => '','public' => true,'show_ui' => true,'show_in_menu' => true,'capability_type' => 'post','hierarchical' => false,'rewrite' => array('slug' => 'tv'),'query_var' => true,'exclude_from_search' => false,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes',),'taxonomies' => array('category','post_tag',),'labels' => array (
  'name' => 'TV Posts',
  'singular_name' => 'TV Post',
  'menu_name' => 'TV Posts',
  'add_new' => 'Add TV Post',
  'add_new_item' => 'Add New TV Post',
  'edit' => 'Edit',
  'edit_item' => 'Edit TV Post',
  'new_item' => 'New TV Post',
  'view' => 'View TV Post',
  'view_item' => 'View TV Post',
  'search_items' => 'Search TV Posts',
  'not_found' => 'No TV Posts Found',
  'not_found_in_trash' => 'No TV Posts Found in Trash',
  'parent' => 'Parent TV Post',
),) );发布于 2012-11-12 14:38:30
如果我明白你在做什么..。
如果将类别设置为在“/类别-name/”加载,并且有一个名为“/ named /”的类别,以及自定义的post类型设置为“/片中/”加载,则会有冲突的元素。重写规则正在竞争。这将是有问题的。如果在注册post类型时将has_archive设置为false,WordPress将不会创建“/false/”归档页,这可能会使您向前迈进一步(尽管您不会为CPT创建存档页面),但是您仍然在混合类别URL和自定义post类型URL,因此我希望还会出现其他问题。
我的回答将是:“我怀疑你是否能正确地完成这个任务,即使你能找到一些你可能不应该做的功能。”
https://wordpress.stackexchange.com/questions/72302
复制相似问题