From 80f78394def119ebbf507adb69257be4c4253374 Mon Sep 17 00:00:00 2001 From: Kelly Dwan Date: Fri, 21 May 2021 17:17:08 -0400 Subject: [PATCH] Pattern CPT & API: Add block types meta field (#111) --- .../includes/pattern-post-type.php | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php b/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php index f0d9badee..4a591daf4 100644 --- a/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php +++ b/public_html/wp-content/plugins/pattern-directory/includes/pattern-post-type.php @@ -143,6 +143,25 @@ function register_post_type_data() { ), ) ); + + register_post_meta( + POST_TYPE, + 'wpop_block_types', + array( + 'type' => 'string', + 'description' => 'A list of block types this pattern supports for transforms.', + 'single' => false, + 'sanitize_callback' => function( $value, $key, $type ) { + return preg_replace( '/[^a-z0-9-\/]/', '', $value ); + }, + 'auth_callback' => __NAMESPACE__ . '\can_edit_this_pattern', + 'show_in_rest' => array( + 'schema' => array( + 'type' => 'string', + ), + ), + ) + ); } /**