。com/provider/abc。com/提供商/xyz等这样,我就可以创建一个常规页面,并为其提供/提供者/URL。我正试图通过更改重写,添加一个slug作为提供者归档来实现这一点。在完成所有这些操作并使用URL/provider/创建一个新页面之后,当我尝试访问所述URL时,仍然可以看到存档。
以下是我的自定义帖子类型的设置方式:
/**
* Register Provider Meta Box
*/
add_action(\'init\', \'cpt_provider\');
function cpt_provider()
{
$labels = array(
\'name\' => _x(\'Providers\', \'post type general name\', \'mebo-cpt\'),
\'singular_name\' => _x(\'Provider\', \'post type singular name\', \'mebo-cpt\'),
\'menu_name\' => _x(\'Providers\', \'admin menu\', \'mebo-cpt\'),
\'name_admin_bar\' => _x(\'Provider\', \'add new on admin bar\', \'mebo-cpt\'),
\'add_new\' => _x(\'Add New\', \'book\', \'mebo-cpt\'),
\'add_new_item\' => __(\'Add New Provider\', \'mebo-cpt\'),
\'new_item\' => __(\'New Provider\', \'mebo-cpt\'),
\'edit_item\' => __(\'Edit Provider\', \'mebo-cpt\'),
\'view_item\' => __(\'View Provider\', \'mebo-cpt\'),
\'all_items\' => __(\'All Providers\', \'mebo-cpt\'),
\'search_items\' => __(\'Search Providers\', \'mebo-cpt\'),
\'parent_item_colon\' => __(\'Parent Providers:\', \'mebo-cpt\'),
\'not_found\' => __(\'No Providers found.\', \'mebo-cpt\'),
\'not_found_in_trash\' => __(\'No Providers found in Trash.\', \'mebo-cpt\')
);
$args = array(
\'labels\' => $labels,
\'description\' => __(\'Description.\', \'mebo-cpt\'),
\'public\' => true,
\'publicly_queryable\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'query_var\' => true,
\'capability_type\' => \'post\',
\'rewrite\' => array( \'slug\' => \'provider-archive\' ),
\'hierarchical\' => true,
\'menu_position\' => null,
\'menu_icon\' => get_template_directory_uri() . \'/img/icons/Gun-512.png\',
\'supports\' => array(\'title\', \'editor\')
);
register_post_type(\'provider\', $args);
}
我有什么遗漏吗?