Add: Template and template_lock to post types endpoint. #6864
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Trac: https://core.trac.wordpress.org/ticket/61477
Backports WordPress/gutenberg#62488 into the core.
Adds template and template_lock property of the post type to post types REST API endpoint.
This change allows to fix a bug where the template of a page is not respected when creating a new page on the site editor.
The update on the unit test is in progress and is still missing.
Testing
With the Gutenberg plugin disabled.
I added the following test code to a PHP file:
I opened the site editor and pasted:
wp.data.select('core').getPostType( 'page' );
I verified the template and template_lock information was included.
I repeated the test with the Gutenberg plugin enabled to make sure things worked well together.