問題描述
客户剛剛創建了一個真正長的 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 輔助翻譯的英文資料結果。如果您對結果不滿意,可以加入我們改善翻譯效果:薇曉朵技術論壇。