我已经在mu_plugins文件夹中创建了自定义帖子类型。但它没有显示在管理菜单栏中。我尝试将代码粘贴到函数中.php,但没有更改。我使用register_post_type函数来创建新的帖子类型。请参阅下面的代码
<?php
function odays_post_types()
{
register_post_type('hotels', array(
'capability_type' => 'hotels',
'map_meta_cap' => true,
'rewrite' => array('slug' => 'hotels'),
'show_in_rest' => true,
'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'custom-fields'),
'has_archive' => true,
'public' => false,
'show_ui' => true,
'labels' => array(
'name' => 'Hotels',
'add_new_item' => 'Add New Hotel',
'edit_item' => 'Edit Hotel',
'all_items' => 'All Hotels',
'singular_name' => 'Hotel'
),
'menu_icon' => 'dashicons-admin-multisite'
));
register_post_type('clinic', array(
'capability_type' => 'clinic',
'map_meta_cap' => true,
'rewrite' => array('slug' => 'clinic'),
'show_in_rest' => true,
'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'custom-fields'),
'public' => true,
'labels' => array(
'name' => 'Clinics',
'add_new_item' => 'Create New Clinic',
'edit_item' => 'Edit Clinic',
'all_items' => 'All Clinics',
'singular_name' => 'Clinic'
),
'menu_icon' => 'dashicons-plus-alt'
));
register_post_type('agent', array(
'capability_type' => 'agent',
'map_meta_cap' => true,
'rewrite' => array('slug' => 'agent'),
'show_in_rest' => true,
'public' => true,
'labels' => array(
'name' => 'Agents',
'add_new_item' => 'Create New Agent',
'edit_item' => 'Edit Agent',
'all_items' => 'All Agents',
'singular_name' => 'Agent'
),
'menu_icon' => 'dashicons-plus-alt'
));
}
add_action('init', 'odays_post_types');
?>
森林海
偶然的你
GCT1015
一只甜甜圈
随时随地看视频慕课网APP