You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When adding a new template part in the admin screen, with the request https://myblog.local/wp-admin/post-new.php?post_type=wp_template_part, WordPress preloads data here. Then there is a call to the route /wp/v2/template-parts/\d+ with a digit as template part identifier, which is filtered by Gutenberg here.
Then the gutenberg_get_block_template() function is called and returnnull because it expects a string identifier (e.g. twentytwentytwo//header) here. This leads to a 404 error in the previous get_item() function.
Although the template part is already created as auto-draft (thanks to WordPress and the call to get_default_post_to_edit()here).
This shouldn't return an error if we expect that wp_template_part post type works like any others.
Also, it prevents anyone to add query parameters to the https://myblog.local/wp-admin/post-new.php?post_type=wp_template_part request to get any information or to add any default value when a template part is created for instance.
Description
When adding a new template part in the admin screen, with the request
https://myblog.local/wp-admin/post-new.php?post_type=wp_template_part
, WordPress preloads data here. Then there is a call to the route/wp/v2/template-parts/\d+
with a digit as template part identifier, which is filtered by Gutenberg here.Then the
gutenberg_get_block_template()
function is called and returnnull
because it expects a string identifier (e.g.twentytwentytwo//header
) here. This leads to a 404 error in the previousget_item()
function.Although the template part is already created as auto-draft (thanks to WordPress and the call to
get_default_post_to_edit()
here).This shouldn't return an error if we expect that
wp_template_part
post type works like any others.Also, it prevents anyone to add query parameters to the
https://myblog.local/wp-admin/post-new.php?post_type=wp_template_part
request to get any information or to add any default value when a template part is created for instance.Step-by-step reproduction instructions
Indeed, the problem can't be seen in the interface.
Screenshots, screen recording, code snippet
No response
Environment info
WordPress 5.8.2, Gutenberg 11.8.3, TwentyTwentyTwo theme.
Please confirm that you have searched existing issues in the repo.
Yes
Please confirm that you have tested with all plugins deactivated except Gutenberg.
Yes
The text was updated successfully, but these errors were encountered: