問題描述

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