#54553 closed defect (bug) (fixed)
Block editor requests to `?_wp-find-template=true` result in a 404 error
Reported by: | noisysocks | Owned by: | hellofromTonya |
---|---|---|---|
Milestone: | 5.9 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Editor | Keywords: | has-patch commit |
Focuses: | Cc: |
Description (last modified by )
Originally reported in https://github.com/WordPress/gutenberg/issues/36986.
If you create a new post (Posts → Add New) and open the Network tab in DevTools you'll see a request made to ?_wp-find-template=true
with a 404 error.
This causes some unexpected behaviour in the post editor, described in the issue above.
I see code which looks like it should handle this query param but the function locate_block_template
doesn't appear to be hooked into wp_loaded
or anything like that.
I suspect something was missed while backporting the block theme infrastructure in #54335 cc. @bernhard-reiter.
Attachments (1)
Change History (13)
#3
@
3 years ago
It seems like we basically need to backport https://github.com/WordPress/gutenberg/pull/32442, which was only merged briefly after the initial backport of custom block templates for pages (https://github.com/WordPress/wordpress-develop/pull/1267).
I'll file a PR!
This ticket was mentioned in PR #1997 on WordPress/wordpress-develop by ockham.
3 years ago
#4
- Keywords has-patch added; needs-patch removed
Originally reported in https://github.com/WordPress/gutenberg/issues/36986.
If you create a new post (Posts → Add New) and open the Network tab in DevTools you'll see a request made to ?_wp-find-template=true
with a 404 error.
This causes some unexpected behaviour in the post editor, described in the issue above.
As @noisysocks correctly suspected in https://core.trac.wordpress.org/ticket/54553, this is because of a missing filter that calls locate_block_template
upon wp_loaded
.
The fix is to basically backport https://github.com/WordPress/gutenberg/pull/32442, which only made it into Gutenberg briefly after the custom block templates for pages infrastructure was backported to Core (https://github.com/WordPress/wordpress-develop/pull/1267).
Trac ticket: https://core.trac.wordpress.org/ticket/54553
This ticket was mentioned in Slack in #core by audrasjb. View the logs.
3 years ago
#7
@
3 years ago
Test Report
Environment
- WordPress 5.9-beta1
- Chrome 96.0.4664.45
- Windows 10
- Theme: Twenty Twenty Two
- Gutenberg Editor
- Plugin: None activated
Steps to reproduce
- Navigate to
Posts > Add New
. - Open DevTools.
- ✅ A 404 error appears:
?p=31&_wp-find-template=true 404 (Not Found)
Steps to test PR 1997
- Apply PR 1997.
- Navigate to
Posts > Add New
. - Open DevTools.
- ✅ The 404 error no longer appears.
#9
@
3 years ago
- Owner set to hellofromTonya
- Status changed from new to reviewing
Self assessing for testing and, if all goes well (which is should), commit.
#10
@
3 years ago
- Keywords commit added
Test Report
Env:
- OS: macOS Big Sur
- WordPress: trunk
- Theme: Twenty Twenty-Two (TT2)
- Plugins: none activated
- Localhost: wp-env
- Browser: Edge, Firefox, Chrome, Safari
Steps to reproduce
- Open DevTools and go to the Console in your browser
- Go to Posts > Add New
- No error should appear in the console
- Switch to the Network tab
- No 404 for should appear
Test Results
Before applying PR:
- A 404 error appears:
GET http://localhost:8889/?p=22&_wp-find-template=true 404 (Not Found)
After applying the PR:
- No error
hellofromtonya commented on PR #1997:
3 years ago
#12
Committed via https://core.trac.wordpress.org/changeset/52316.
I'll look into this!