最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I increase the length for the taxonomy term slug?

programmeradmin1浏览0评论

I am trying to create a new term in topic taxonomy. Since I am writing in Bangla Unicode instead of English, the slug is created with lesser/broken text.

Is there any hook to update the length for the taxonomy term slug?

I am trying to create a new term in topic taxonomy. Since I am writing in Bangla Unicode instead of English, the slug is created with lesser/broken text.

Is there any hook to update the length for the taxonomy term slug?

Share Improve this question asked Feb 12, 2021 at 13:46 Shah AlomShah Alom 4981 gold badge5 silver badges14 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

By default WordPress sets the length of that field to 200 when the database tables are created.

Now you could change that by running this SQL command in your console (change the tabe prefix to your setting, and make a backup first):

ALTER TABLE wp_terms MODIFY COLUMN slug VARCHAR(1000);

But … the nice name, the first field in your screenshot, has the same restriction, and it's not truncated. Also I don't see anything in the WordPress code that enforces a restriction on the slug before it is inserted into the database. It's possible I missed that in the callback hell that WP is.

So do a test run for this in a safe, exact copy of your site and see if it fixes your issue. Also make sure you don't insert invalid characters, because they will lead to truncated values. This can happen when you are using copy&paste from a software that isn't completely Unicode compatible, like Word.

The other "solution" is just to use shorter slugs.

发布评论

评论列表(0)

  1. 暂无评论