问题描述
客户刚刚创建了一个真正长的 s 子 (90 个字符) 的帖子,没有特殊字符 (连字符除外) 等。
每当从管理员后端点击链接到该帖子,包括”Preview” 或 「查看此帖」 链接时,就会生成 404 。
一旦我们手动修剪了 s 子,一切都按预期工作。这是”feature” 还是”bug”?
编辑:所有谈论数据库限制的人的注释。
If I were hitting the DB field limit, then the slug itself would be truncated. Think about it for a second. In the case of most WP installations, wp_posts.post_name is VARCHAR(200). So, let’s say that someone types in a title with > 200 chars. What happens? The slug gets truncated to 200 chars and stored in wp_posts.post_name. It’s not like someone is going in and typing the full title of the post in the browser address bar, substituting the spaces with dashes right? The URL is being generated by WordPress, and it’s getting the URL from the wp_posts.post_name table and just putting that in the href attribute of the anchor tag. So there’s not going to be a disparity there. The whole DB thing is a red herring.
在任何情况下,有问题的 s 子只有 90 个字符,所以它与 DB 限制无关。
是否有任何已知的重写限制?
最佳解决方案
由于 wp_posts 表结构,post_name 列的长度 (slugs 的列) 等于 200 个字符。
参考文献
注:本文内容整合自 Google/Baidu/Bing 辅助翻译的英文资料结果。如果您对结果不满意,可以加入我们改善翻译效果:薇晓朵技术论坛。