自定义Url结构的博客文章,而不是成员和投资组合


Custom Url structure for blog posts not for members and portfolios

如果我更改永久链接设置,则所有帖子类型都使用该结构。例如:

https://www.domain.dom/blog/%category%/%postname%/

则投资组合项解析为

https://www.domain.dom/blog/portfolio/item/

和我想从url中删除/blog/时,显示成员的投资组合,常见问题等

我发现了这个,但不知道我是否需要注册新的帖子类型,把它放在主题函数。php或该怎么办?

我真的需要一些关于如何做到这一点的指导。

谢谢

这比你想象的要简单,添加一个php文件到wp-content/plugins目录,添加一个插件头注释,然后调用register_post_type(),例如:

<?php
/**
Plugin Name: My custom profiles
...
*/
add_action('init', function() {
    register_post_type('my_custom_profile', [
        'label' => 'Profiles',
        ...
    ]);
});