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

Template Mode: Preload templates OPTIONS #33994

Closed
Mamaduka opened this issue Aug 11, 2021 · 3 comments · Fixed by #42209
Closed

Template Mode: Preload templates OPTIONS #33994

Mamaduka opened this issue Aug 11, 2021 · 3 comments · Fixed by #42209
Assignees
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress

Comments

@Mamaduka
Copy link
Member

Recently capability checks were added to some Templates actions, like creating a new template. See #33392.

It might be a good idea to preload OPTIONS for the /wp/v2/templates REST API path. Like we do for media and blocks.

Should I create PR for WP core, or might it be better to add this to the plugin first?

/cc @gziolo @youknowriad

@Mamaduka Mamaduka added [Feature] Template Editing Mode Related to the template editor available in the Block Editor REST API Interaction Related to REST API labels Aug 11, 2021
@gziolo
Copy link
Member

gziolo commented Aug 11, 2021

Should I create PR for WP core, or might it be better to add this to the plugin first?

You can use the block_editor_rest_api_preload_paths filter in the plugin:

https://github.com/WordPress/wordpress-develop/blob/9b565f7907ca1d4cb32eccc980de98683758df17/src/wp-includes/block-editor.php#L412

I would say it's simple enough to apply in both places.

@Mamaduka
Copy link
Member Author

Thanks for the feedback, @gziolo.

I assume lib/compat/wordpress-5-8 will be the right directory for this code, right?

@gziolo
Copy link
Member

gziolo commented Aug 11, 2021

I assume lib/compat/wordpress-5-8 will be the right directory for this code, right?

Yes, it only should be lib/compat/wordpress-5-9 as we are bridging functionality that is going to be included by default in WP 5.9.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Template Editing Mode Related to the template editor available in the Block Editor REST API Interaction Related to REST API [Status] In Progress Tracking issues with work in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants