Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CPTUI allow non unique slug #808

Open
sebastienserre opened this issue May 2, 2021 · 1 comment
Open

CPTUI allow non unique slug #808

sebastienserre opened this issue May 2, 2021 · 1 comment
Labels
i18n Internationalization

Comments

@sebastienserre
Copy link

Hello,

I'm Sébastien from Polylang (support) team.

We have several users/customers in common which fail in the same issue and I think you should keep them from it.
In our side, we will think about a behavior to prevent Editor fatal error.

Today, each admin can create CPT and Taxonomy thanks to CPTUI, and they're allowed to create CPT and Taxonomy with the same slug. More over, they can use already existing slug.

It's problematic as the Rest Api used by the editor has a problem to retrieve correctly the content by choosing the wrong content due to several contents with the same slug.

In Polylang Case, it retrieves content without translation for a translatable content... and it produces a JS fatal error in the editor. We'll manage it to prevent bad experiences.

To avoid having this. Should it be possible to check on CPT and Taxo creation if the slug chosen by the user is available (Not already in use and not in the WordPress reserved terms) ?

Thank you very much

@tw2113
Copy link
Member

tw2113 commented May 3, 2021

Hi Sébastien,

Definitely open to ideas and how we could make this even more robust, but I wanted to point out quick a few things we have in place for what we're already doing.

For example, here's where were already checking for existing post types. First reserved ones, followed by both public and private ones registered by other plugins/developers
https://github.com/WebDevStudios/custom-post-type-ui/blob/master/inc/post-types.php#L1876

We're also checking PAGES for conflicting slugs because these can cause conflicts at the archive URL level, from our experiences:
https://github.com/WebDevStudios/custom-post-type-ui/blob/master/inc/post-types.php#L1914

However, we're not checking for TOO much else, but we do have this filter in place for other developers to use if they wanted to, to get their own values put in place for whatever reason.
https://github.com/WebDevStudios/custom-post-type-ui/blob/master/inc/post-types.php#L1817-L1826

Perhaps this filter could be utilized in some way that we're not already handling on our own. That said, open to merging in solutions if they look solid, instead of just leaving on the shoulders of your specific use cases.

@tw2113 tw2113 added the i18n Internationalization label Nov 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
i18n Internationalization
Projects
None yet
Development

No branches or pull requests

2 participants