[wp-trac] [WordPress Trac] #54070: Increase CPT "machine name" limit from its current maximum of 20 characters.
WordPress Trac
noreply at wordpress.org
Thu Sep 16 15:19:26 UTC 2021
#54070: Increase CPT "machine name" limit from its current maximum of 20
characters.
-------------------------------------------------+-------------------------
Reporter: taupecat | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone: Awaiting
| Review
Component: Database | Version: trunk
Severity: normal | Resolution:
Keywords: dev-feedback needs-codex has-patch | Focuses: coding-
has-unit-tests | standards
-------------------------------------------------+-------------------------
Comment (by taupecat):
Replying to [comment:9 ocean90]:
> We already have a ticket for this request in #37104 which was closed as
maybelater. A similar one is #39507, closed as wontfix.
>
> Could you provide some real use cases where a longer post type name
would be required?
Wow, okay, this is out of left field.
I [posed the question on
Twitter](https://twitter.com/taupecat/status/1433424418978492423) recently
as to why the 20 character limit. Both the blog post referenced by a
ticket you pointed and other research done by @zodiac1978 indicated that
the 20 character limit (down from 100) was an attempt to improve database
performance which ended up having no appreciable effect at the time. ''And
that was 15 years ago.''
So maybe the question should be, what was the use case to bring it down
from 100 to 20 in the first place, and why did that limit stay in effect
when it didn't accomplish the stated goal?
Among the responses to my Twitter post were [comments from
@markjaquith](https://twitter.com/markjaquith/status/1433431774965624848)
and others indicating that the limit ''should'' be raised. So I'm
proposing a very simple fix to raise it.
I can't provide ''specific'' use case for increasing the limit other than
20 characters is unreasonably low when one wants to incorporate sensible
namespacing in custom post type names, especially when one considers that
custom taxonomy names have a ''32'' character limit. I've run headlong
into this limit in previous projects, and have always had to make
adjustments, sometimes compromising good namespacing practices. This
ticket is to help developers in the future have a little breathing room so
that they ''don't'' have to make similar adjustments when adding a
namespace to their custom post type names.
I'm willing to do the (rather minimal) work here, and I saw the comment
that the Codex will need an update patch which I will submit as soon as I
can spare a few minutes to do that.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54070#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list