我创建了一个自定义的帖子类型,并指定了一个重写来将永久链接更改为/old donuts/。请参见下面的代码:
function donut_newsletters_post_type() {
$labels = array(
\'name\' => \' Newsletters\',
\'singular_name\' => \' Newsletter\',
\'add_new\' => \'Add \',
\'add_new_item\' => \'Add New \',
\'edit_item\' => \'Edit \',
\'new_item\' => \'New \',
\'view_item\' => \'View \',
\'search_item\' => \'Search Daily s\',
\'not_found\' => \'No s found\',
\'not_found_in_trash\' => \'NO s found in the trash..that would be a sin\'
);
$args = array(
\'labels\' => $labels,
\'public\' => true,
\'has_archive\' => false,
\'publicly_queryable\' => true,
\'query_var\' => true,
\'rewrite\' => array(
\'slug\' => \'old-donuts\'
),
\'capability_type\' => \'post\',
\'hierarchical\' => false,
\'supports\' => array(
\'title\',
\'editor\',
\'excerpt\',
\'thumbnail\'
),
\'taxonomies\' => array(\'post_tags\'),
\'menu_position\' => 0,
\'exclude_from_search\' => true,
\'menu_icon\' => \'dashicons-email\'
);
register_post_type(\'donut_newsletters\', $args);
}
add_action(\'init\', \'donut_newsletters_post_type\');
现在,假设我创建了一个新帖子并将其命名为“test”,永久链接默认为
https://thedonut.co/old-donuts/testI don\'t want this. 什么是我do 希望permalink默认为如下自定义日期结构:
https://thedonut.co/old-donuts/2019-08-24/
我还希望编辑可以修改permalink,这样,如果他/她必须在他们想要发布的前一天创建帖子,他们可以将日值更改为第二天。
请不要将我发送到插件。我已经尝试过自定义post类型的permalinks插件,它可以满足我的需要,但它不允许在发布帖子后修改permalink。