尝试使用此插件,但似乎不起作用:https://wordpress.org/plugins/custom-post-type-permalinks/
我正在设置设置中的博客帖子的永久链接结构>;像这样的永久链接:/blog/%postname%
我还有一个自定义的post类型,名为;“项目”;,我想要结构的位置/our-work/%postname
, 但相反/blog
部分也在这里预先准备好了。如何为这种自定义帖子类型保留单独的永久链接结构?
这是register_post_type
功能:
register_post_type(\'project\', array(
\'public\' => true,
\'custom\' => true,
\'show_ui\' => true,
\'supports\' => array(\'title\',\'editor\',\'revisions\'),
\'labels\' => array(
\'name\' => \'Projects\',
\'singular_name\' => \'Project\',
\'add_new_item\' => \'Add New Project\',
\'edit_item\' => \'Edit Project\'
),
\'menu_icon\' => \'dashicons-portfolio\',
\'show_ui\' => true,
\'show_in_menu\' => true,
\'show_in_rest\' => true,
\'rewrite\' => array(
\'slug\' => \'our-work\',
\'with_front\' => true
),
\'has_archive\' => true,
\'show_in_graphql\' => true,
\'graphql_single_name\' => \'project\',
\'graphql_plural_name\' => \'projects\',
\'cptp_permalink_structure\' => \'%post_id%\'
));