删除 WordPress 自定义分类库

发布于 2024-10-10 17:25:28 字数 230 浏览 4 评论 0原文

我在 WordPress 3.0.4 中使用自定义分类

有谁知道如何从 URL 中删除分类基础吗?

我见过一些插件可以为类别和标签执行此操作,但不能为自定义分类法执行此操作。

例如,我有一个名为“城市”的自定义分类法。我希望我的 URL 结构为 mydomain.com/newyork 而不是 mydomain.com/cities/newyork

是否有我可以使用的功能或东西?

I am using custom taxonomies with WordPress 3.0.4

Does anyone how to remove the taxonomy base from the URL?

I have seen plugins that do it for categories and tags, but not for custom taxonomies.

For example, I have a custom taxonomy called 'cities'. I would like my URL structure to be mydomain.com/newyork instead of mydomain.com/cities/newyork

Is there a function or something I can use?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

ゃ懵逼小萝莉 2024-10-17 17:25:28

@iamfriend 和 @Carson - 将 with_front 参数设置为 false(或 true)将不允许您从 URL 中删除“城市”。

@iamfriendly and @Carson - setting the with_front argument to false (or true for that matter) will not allow you to remove 'cities' from the URL.

北恋 2024-10-17 17:25:28

http://codex.wordpress.org/Function_Reference/register_taxonomy

如果你看那里,你会看到一个“重写”论点,你可以看到它是正确的。此参数还采用“with_front”参数,默认为 true...这就是为什么您拥有分类法的“front”。

创建自定义分类法时,根据需要设置这些参数,然后您就可以离开了:)

如果设置了此自定义分类法,那么您就可以实际设置 with_front false 参数将阻止这种情况发生。如果你看这里:

http://codex.wordpress.org/Function_Reference/register_taxonomy

你会查看“rewrite”参数,在其下方,您将看到“with_front”部分。

http://codex.wordpress.org/Function_Reference/register_taxonomy

If you look there, you'll see a 'rewrite' argument which you can see to true. This argument also takes an argument of 'with_front' which defaults to true... which is why you have the 'front' of the taxonomy.

When creating your custom taxonomy, set those arguments as you wish, and you'll be away :)

If it is you who has set up this custom taxonomy, then you're able to actually set the with_front argument to false which will stop this happening. If you look here:

http://codex.wordpress.org/Function_Reference/register_taxonomy

You'll see the 'rewrite' argument and just below that, you'll see the 'with_front' part.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文