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

Add: Post types to wp-rest-block-patterns-controller.php. #3292

Conversation

jorgefilipecosta
Copy link
Member

@jorgefilipecosta jorgefilipecosta commented Sep 20, 2022

Backports PHP changes in WordPress/gutenberg#41791 to the core. Adding the post types property to the rest API.

Testing

Added the following code snippet:

register_block_pattern( 'custom-pattern', array(
			'title'      => _x( 'Start post pattern', 'Block pattern title', 'gutenberg' ),
			'blockTypes' => array( 'core/paragraph', 'core/post-content' ),
			'postTypes' => array( 'post' ),
			'content'    => '<!-- wp:paragraph -->
<p>A start post pattern</p>
<!-- /wp:paragraph -->',
		) );

Opened the editor pasted on the browser console:

wp.apiFetch( { path: '/wp/v2/block-patterns/patterns' } ).then( console.log );

Verified post types was included in the rest response as part of custom-pattern.

@jorgefilipecosta
Copy link
Member Author

Committed in 4fbb3b9.

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.

1 participant