trim the post_name in phpMyAdmin?
-
I’d like to trim my post_name to 16 characters to shorten my URLs. I’m wondering if I should go into phpMyAdmin and change varchar(200) to varchar(16) for post_name. If I go from varchar(200) to varchar(16), will I just be deleting the data after character 16 and holding onto the first 16 characters? (That’s what I’m hoping.)
Since post_name is generated from post_title in wordpress, and the post_title is often going to be longer than 16 characters, will this cause some kind of error in WP when a title is longer than 16 characters? or will the database store the first 16 characters it is sent and disregard the rest (that’s what I’m hoping.) BTW, the post_name will always be generated from post_title in my blog because the slug field will be left blank. Meanwhile, I have a lot of imported posts that don’t have a slug. (In the logic of post.php, it looks like it first tries to get the post_name from the slug field, and then if there is no data for the slug, it sanitizes the post_title instead.)
I’m sure there are other ways to trim the post_name with PHP, but I’m concerned about what the impact will be if I start messing with the PHP. So I’m wondering if limiting the string length with phpMyAdmin is the simplest way to proceed.
- The topic ‘trim the post_name in phpMyAdmin?’ is closed to new replies.