0

I'm change the default attributes:

const blockAttrs = {
        avatarSize: {
            type: 'number',
            default: 120, // 70 -> 120
        },
        //other attrs
      };

Deprecated function:

deprecated: [
            {
                attributes: {
                    ...blockAttrs,
                    avatarSize: {
                        type: 'number',
                        default: 70
                    }
                },
                save: function ( { attributes } ) {}
            }
        ]

But when i refresh post, block still display error: enter image description here

Someone

1
  • Can you post the entire block code?
    – Welcher
    Oct 21 '19 at 20:35
2

Looking at the documentation from https://developer.wordpress.org/block-editor/developers/block-api/block-deprecation/

I think you may need the following

 migrate( { text } ) {
            return {
                content: text
            };
        },

So in your case:

migrate( { avatarSize } ) {
            avatarSize: {
                    type: 'number',
                    default: 70
                }  content: text
            };
        },

Hopefully points you in the correct direction

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.