Deprecation for WP Blocks

I don’t fully understand the Deprecation feature of G Blocks but if it can help solve the issue of “Attempt Block Recovery” notice every time you make a minor change to a block it would be a huge help. Right now I find myself deep into a new website and need to make an update to a block sitewide but get tons of “Attempt Block Recovery” notices which don’t look great from the client’s perspective and if there are hundreds of them is laborious to go into every post/page and update them manually. -Thanks

@jonroc this is one area where WP core needs to make progress. There should be site-wide update block(s) option in WP.

One idea I’m entertaining is to export hybrid blocks - JS in the editor and PHP on the frontend. That would make sure that blocks are always displayed up to date and avoid the recovery completely.

1 Like

During the development phase with Pinegrow, for each modified block, the author will find himself in this painful situation, but it is understandable and acceptable.

Once the site is in production, the author will have two choices to update the structure of his blocks:

  • Do not deprecate the block and create a new one (a different name)
  • Provide a “deprecated” version of the block allowing users opening these in the block editor to edit them using the updated block.

@matjaz has indeed recently envisaged a solution (hybrid blocks) intended to facilitate the life of the authors/developers who very regularly modify the definitions of blocks, mainly because of the facility offered by Pinegrow for such operations.

*HYBRID BLOCKS: rendering JS in the editor to ensure superior editing experience, and PHP rendering on the front-end to always serve the correct version of the block and up-to-date dynamic data.

The data & display would be 100% the same in the editor and on the front-end. The only drawback would be a slight performance hit from rendering each block with PHP. It might be negligible.

ETA: After the 1.0 release of the Pinegrow plugin for WordPress. For now, it’s just an idea floating around.

1 Like

Since you first mentioned the idea of hybrid blocks i just can’t stop thinking about them :smiley: i think that would solve a lot of problems indeed! :wink:

1 Like

Sounds great! Do you think exporting blocks to a PG plugin (vs exporting to a theme) would be viable as an official plugin for I realize I’d have to manually add in some things like an update feature but do you see any reason PG could not act as my base for a “real” WP community plugin?

@matjaz Will SEO plugins be able analyse/read the hybrid block content? Most of them parse html and analyse the content.

Will the hybrid block content be like this?

<!-- wp:custom/heading {"htmlRender":"\u003ch1\u003eTest\u003c/h1\u003e","content":"Test","uniqueID":"c97ddbd8-a7f1-49d8-b5dc-024ed74df2a8","classID":"heading-c4df2a8","id":"heading-cc97ddb"} /-->

@jonroc I guess it could be, but I haven’t tried to submit a plugin to WP plugin store.

They should. It’s just the content, doesn’t matter how it is implemented.

No, I meant the content on the back-end. Most SEO plugins read/analyse the content on the back-end. They are able to analyse the normal/js blocks as the block html is available for them to scan. They are not able to scan the dynamic blocks since the html output is not available and it’s dynamically generated/render from the php file. So I was wondering how will be the behaviour with the hybrid blocks.

Are you sure about this? WP function get_the_content() returns the content of the post with all blocks (JS and PHP) evaluated. I don’t see a reason why a SEO plugin could not use this information on the backend. NOTE: I’m saying this without looking closer at various SEO plugins. Just, as a WP developer, I can say that all data is there, available to be used.

@matjaz I think most such plugins do not rely on that particular function as they provide real time analysis as you type the content in the blocks. I will dig more into it. It’s not your issue in any case.