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
    Commented Oct 21, 2019 at 20:35

2 Answers 2

1

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

0

Your save function needs to return a valid React component or null.

save: function ( { attributes } ) {}

should be

save: function ( { attributes } ) { return null; }
2
  • That sounds plausible, but it's not obvious to me from the question that is the problem. Can you elaborate please?
    – Rup
    Commented Feb 12, 2022 at 15:33
  • save: function ( { attributes } ) {} should be save: function ( { attributes } ) { return null; }
    – JonShipman
    Commented Feb 14, 2022 at 20:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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