Skip to content

Supporting hyphens on endpoints #257

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

Merged
merged 1 commit into from
Dec 2, 2016
Merged

Conversation

gambry
Copy link
Contributor

@gambry gambry commented Dec 2, 2016

According with https://developer.wordpress.org/reference/functions/register_post_type/#parameters custom post types can have both underscore and hyphens, resulting in endpoints like my_content or my-content. Current API supports only underscore.

I'm not a WP or a Node developer, but I think this should be either addressed or at least documented.
A temporary workaround is to call the endpoint with site['my-content'].get().

This patch add hyphens supports on routes names replacing.

Ideally the exact regexp should be [^a-z]+, in order to cover any future changes and plugins creating weird endpoints.

@bmac bmac added the ready label Dec 2, 2016
@kadamwhite
Copy link
Collaborator

@gambry Thank you for the pull request, that's a good catch—I'll merge this and open an issue to discuss the auto-renaming behavior in general

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants