Answer the question
In order to leave comments, you need to log in
How to deal with wordpress 'query' attribute?
Good evening, the next question. I created a widget and I need to somehow store an array of data in its props.
https://developer.wordpress.org/block-editor/refer...
I need to save an array of data, and as I understand it, this is an ideal option.
What I did:
Created an attribute
span: {
type: 'array',
source: 'query',
selector: 'span',
query: {
value: {
type: 'string',
source: 'attribute',
attribute: 'value',
}
}
}
el(
'span',
{
value: 'test',
onClick: test
},
'span text'
),
function test(event){
span = [
{ "value": "https://lorempixel.com/1200/800/",},
{ "value": "https://lorempixel.com/50/50/",}
];
props.setAttributes({span: span});
}
Answer the question
In order to leave comments, you need to log in
I figured
out Edith is taken based on save
lol
while I am writing a question - I myself find the answer
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question