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 badges1 Answer
Reset to default 0By 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.