Skip to content

Commit

Permalink
Pattern CPT & API: Add block types meta field (#111)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle authored May 21, 2021
1 parent a8b9c89 commit 80f7839
Showing 1 changed file with 19 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
),
),
)
);
}

/**
Expand Down

0 comments on commit 80f7839

Please sign in to comment.