Prevent changing the length of post_name column on WordPress Update
We’ve some Arabic websites running on WordPress, and use Arabic slugs in the posts’ URLs.
You know that post slug is stored in the post_name
column in wp_posts
table, and the default length of this column is 200
characters, which is not enough for Arabic slugs that are being encoded before being stored in this column. For that, we changed the length of this column to 1000
characters to hold the long encoded slugs that we have.
The issue, when we update the WordPress code to a major update, it trims this column back to 200
characters, and this breaks the posts’ URLs. This happens if you login for the first time after the update to the CMS or do a Network Upgrade that is prompted after each major update.
Is there any way to prevent WordPress from touching the tables’ structure?
Leave an answer