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

Templates Controller: Fix slug pattern to allow 404 templates #2077

Closed
wants to merge 3 commits into from
Closed

Templates Controller: Fix slug pattern to allow 404 templates #2077

wants to merge 3 commits into from

Conversation

ockham
Copy link
Contributor

@ockham ockham commented Dec 22, 2021

Backport of WordPress/gutenberg#37579. Props @PatelUtkarsh.

Quoting WordPress/gutenberg#37579:

Description

Adding 404 template from /wp-admin/site-editor.php?postType=wp_template causes 400 with rest_invalid_pattern

How has this been tested?

  • Theme without 404 templates.
  • Open /wp-admin/site-editor.php?postType=wp_template
  • Add new 404 templates.
  • Used nightly WordPress build to test this.

Screenshots

Bug:

adding-404-template.mp4

Trac ticket: https://core.trac.wordpress.org/ticket/54680


This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.

@ockham
Copy link
Contributor Author

ockham commented Dec 23, 2021

cc/ @hellofromtonya @noisysocks @youknowriad -- I think this should go into 5.9 :)

@SergeyBiryukov
Copy link
Member

Thanks for the PR! This looks good to me. It would also be great to include a unit test for this, some other tests in the phpunit/tests/rest-api/wpRestTemplatesController.php file could be used as a reference.

@ockham
Copy link
Contributor Author

ockham commented Jan 3, 2022

Thanks for the PR! This looks good to me. It would also be great to include a unit test for this, some other tests in the phpunit/tests/rest-api/wpRestTemplatesController.php file could be used as a reference.

Sure, happy to add a test!

Copy link
Contributor

@hellofromtonya hellofromtonya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the integration test @ockham! LGTM 👍 Ready for commit.

@ockham
Copy link
Contributor Author

ockham commented Jan 4, 2022

Thanks a lot for reviewing @SergeyBiryukov @rachelbaker @hellofromtonya!

Since I don't have Core commit privileges myself, can I ask one of you kind souls to commit this? 😄

@audrasjb
Copy link
Contributor

audrasjb commented Jan 4, 2022

Committed in https://core.trac.wordpress.org/changeset/52436

@audrasjb audrasjb closed this Jan 4, 2022
@ockham ockham deleted the fix/template-controller-slug-pattern branch January 4, 2022 16:34
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.

5 participants