编辑器角色可以打开以下URL:
https://example.com/wp-admin/edit.php?booking-status=booked&post_type=booking
但无法打开以下URL:
https://example.com/wp-admin/edit.php?post_type=booking
当我用
post_type
然后它会打开自定义帖子类型编辑屏幕,但当我只通过
post_type
那么它就不能打开了。
这只发生在编辑器角色上。
<?php
function create_booking_post_type() {
$labels = array(
\'name\' => __( \'Bookings\',\'framework\'),
\'singular_name\' => __( \'booking\',\'framework\' ),
\'add_new\' => __(\'Add New\',\'framework\'),
\'add_new_item\' => __(\'Add New booking\',\'framework\'),
\'edit_item\' => __(\'Edit booking\',\'framework\'),
\'new_item\' => __(\'New booking\',\'framework\'),
\'view_item\' => __(\'View booking\',\'framework\'),
\'search_items\' => __(\'Search booking\',\'framework\'),
\'not_found\' => __(\'No booking found\',\'framework\'),
\'not_found_in_trash\' => __(\'No booking found in Trash\',\'framework\'),
\'parent_item_colon\' => \'\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'query_var\' => true,
\'has_archive\' => true,
\'capability_type\' => \'post\',
\'hierarchical\' => true,
\'menu_position\' => 5,
\'supports\' => array(
\'title\',\'editor\',\'thumbnail\',\'revisions\',\'author\',\'page-attributes\'),
\'rewrite\' => array( \'slug\' => __(\'booking\', \'framework\') )
);
register_post_type(\'booking\',$args);
}