Suggestion: Limit Custom Post Type slug to 20 characters

Support MB Custom Post Type Suggestion: Limit Custom Post Type slug to 20 charactersResolved

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #13415
    Lisa TallyLisa Tally
    Participant

    Recently I encountered an issue trying to create a new Custom Post Type. I created it and published, but it did not show up in the menu as expected. I found the issue was the automatically created slug was longer than 20 characters:

    $post_type
    (string) (required) Post type. (max. 20 characters, cannot contain capital letters, underscores or spaces)
    Default: None

    https://codex.wordpress.org/Function_Reference/register_post_type

    I'd recommend limiting the automatic slug creation to 20 characters. Some UI element to count the characters with a warning why it is limited may help future users.

    My use case:
    CPT name of 'Business Directory Listing' converts to 'business-directory-listing' (26 characters) Changing it to 'biz-dir-listing' fixed the issue. Maybe there's a good reason why it is limited to 20 characters, but it seems awfully small to me.

    #13417
    Anh TranAnh Tran
    Keymaster

    Hi Purdue,

    This is a good suggestion. At the moment, there's no restriction yet. I'll add that to the next version.

    #13580
    Anh TranAnh Tran
    Keymaster

    It's done in the latest version of the plugin. Please update!

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.