您好我有一个非常奇怪的情况:我创建了一个CPT(WP 4.7),我甚至可以创建一个自定义帖子。但是,“添加新”按钮停止工作,只会转到主页。这种情况只发生在这个新的CPT上,因为其他CPT正常工作。
这是我使用的代码:
add_action( 'init', 'create_recipes' );
function create_recipes() {
$labels = array(
'name' => 'Recipes',
'singular_name' => 'Recipe',
'menu_name' => 'Recipe',
'name_admin_bar' => 'Recipe',
'add_new' => 'Add New',
'add_new_item' => 'Add New Recipe',
'new_item' => 'New Recipe',
'edit_item' => 'Edit Recipe',
'view_item' => 'View Recipe',
'all_items' => 'All Recipes',
'search_items' => 'Search Recipes',
'parent_item_colon' => 'Parent Recipes:',
'not_found' => 'No recipes found.',
'not_found_in_trash' => 'No recipes found in Trash.'
);
$args = array(
'public' => true,
'labels' => $labels,
'description' => 'Create your own recipes',
'show_ui' => true,
'capability_type' => 'post',
'menu_icon' => 'dashicons-carrot',
'rewrite' => true,
'menu_position' => 4,
'supports' => array('title', 'editor','thumbnail')
);
register_post_type( 'recipe', $args );
}
与往常一样,我们将非常感谢任何帮助