There are topics in the support forum asking about the length of the name of the post types. I remember once I asked myself the same question.
Was it like this since the beginning?
Currently (4.5.2), the schema for the database is located in the wp-admin/includes/schema.php
file. At line 162 we can see it that the post_type
column is set to varchar(20)
.
I hunted down when was the post_type
introduced since I knew that there were no types of posts. Pages were added later.
When posts types were introduced the schema was located in a different file, namely wp-admin/upgrade-schema.php
and surprise, surprise it was varchar(100)
.
We had 100 character limit until “Some optimization of the post query” was made to the schema, at least this is what the commit message states.
The commit has a closed ticket linked to it, this is where this story ends… with a punch.
It looks like there was a guy with the nickname rboren, who made some suggestion in the #wordpress room and photomatt, aka matt, made sure that is not forgotten.
(11:49:03) photomatt: did you guys see the mysql guy in #wordpress last night?
…
(11:49:53) photomatt: (he also suggested making post_type a shorter varchar, maybe 10-20)
https://core.trac.wordpress.org/attachment/ticket/2604/sql_chat.txt
Later ryan made the modifications – changed the length to 20 – and he made this remark:
Added composite key (post_type, post_status, post_date) and shortened post_type from 100 to 20. Didn’t make a difference to performance.