One of our blocks has stopped working, I understand its probably due to the ‘post_taxs_obj’ not being included in the PHP register_block_type attributes but I’m not sure how to resolve this – can anyone please advise? (I’m not a dev, just trying to jump in and fix this so any help would be much appreciated):
Error:
{"code":"rest_invalid_param","message":"Invalid parameter(s): attributes","data":{"status":400,"params":{"attributes":"post_taxs_obj is not a valid property of Object."},"details":{"attributes":{"code":"rest_additional_properties_forbidden","message":"post_taxs_obj is not a valid property of Object.","data":null}}}}
Here’s the PHP:
register_block_type( 'performancein/article-listing',
array(
'render_callback' => 'performancein_article_listing_callback',
'attributes' => [
'post_type' => [
'default' => '',
'type' => 'string'
],
'post_taxs' => [
'default' => '',
'type' => 'string'
],
'post_category' => [
'default' => '',
'type' => 'string'
],
'number_of_post' => [
'default' => '0',
'type' => 'number'
],
'category_description' => [
'default' => false,
'type' => 'bool'
],
'exclude_post' => [
'default' => '',
'type' => 'string'
],
]
)
);
And the JS:
registerBlockType('performancein/article-listing', {
title: 'Article Listing',
icon: ArticleIcon,
category: 'performancein',
keywords: [__('ArticleFilter'), __('gutenberg'), __('performancein')],
description: __( 'It showcase article listing ' ),
example: {
attributes: {
caption: __( 'Article Listing' ),
},
},
attributes: {
number_of_post: {
type: 'number',
default: '0',
},
post_type: {
default: '',
type: 'string',
},
post_type_obj: {
type: 'json',
},
post_taxs: {
default: '',
type: 'string',
},
post_taxs_obj: {
default: [{label: '--Select Taxonomy--', value: ''}],
type: 'json',
},
post_category: {
default: '',
type: 'string',
},
post_category_obj: {
default: [{label: '--Select Category--', value: ''}],
type: 'json',
},
category_description: {
default: false,
type: 'boolean',
},
exclude_post: {type: 'string'},
design_option: {
type: 'string',
default: '',
},
},