最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

block editor - How to Batch Convert Gutenberg post to Classic post?

programmeradmin5浏览0评论

I create hundreds of posts with Gutenberg block editor. Now I want to convert all of them to classic posts. How to do so?

Update

The reason of doing so:

  1. The Gutenberg block will introduce a large block CSS file, which will decrease the performance of our website.
  2. We do not need the special functionalities of the block editor, such as dynamic block, so a classic editor is enough for us to use.

Update 2

Currently I do the followings:

  1. Install Classic Editor and use it as the default editor.
  2. Try to find wp:paragraph in all databases and find some posts that are edit with the new block editor. You can also make the search via post search, it will bring out all the posts edited with block editor.
  3. Edit those posts with the classic editor. I does not find any issues when using the classic editor to edit these posts. So I guess everything is fine?

I create hundreds of posts with Gutenberg block editor. Now I want to convert all of them to classic posts. How to do so?

Update

The reason of doing so:

  1. The Gutenberg block will introduce a large block CSS file, which will decrease the performance of our website.
  2. We do not need the special functionalities of the block editor, such as dynamic block, so a classic editor is enough for us to use.

Update 2

Currently I do the followings:

  1. Install Classic Editor and use it as the default editor.
  2. Try to find wp:paragraph in all databases and find some posts that are edit with the new block editor. You can also make the search via post search, it will bring out all the posts edited with block editor.
  3. Edit those posts with the classic editor. I does not find any issues when using the classic editor to edit these posts. So I guess everything is fine?
Share Improve this question edited Aug 10, 2021 at 6:16 alancc asked Aug 9, 2021 at 9:06 alanccalancc 416 bronze badges 5
  • 1 Which problem does this solve? Usually people ask how to do it the other way. Note that a lot of blocks use markup the classic editor wasn't built to handle, and dynamic blocks won't work in the classic editor. The HTML comments a lot of blocks depend on may be stripped out accidentally – Tom J Nowell Commented Aug 9, 2021 at 9:45
  • @TomJNowell, Thank you very much. I have just updated the post which explain the reason why I need to convert in that way. – alancc Commented Aug 9, 2021 at 22:32
  • 1 if the issue is that gutenberg adds a large CSS block, why not ask how to remove it? – Tom J Nowell Commented Aug 10, 2021 at 8:46
  • @TomJNowell, I have asked about that at stackoverflow/questions/68709260/…, and someone just down-vote it, I think I should not ask that question. – alancc Commented Aug 10, 2021 at 11:23
  • 1 better to ask that question here rather than on stackoverflow – Tom J Nowell Commented Aug 10, 2021 at 13:01
Add a comment  | 

1 Answer 1

Reset to default 0

You probably can't, or at least it is not going to be easy and will not result with the savings you want.

As gutenberg do not have separation between content and meta data about the content you will have to parse the current content to strip the meta data from the content and store it in some other place, but even then you will still need to do some output based on the meta data and since the document was editted with gutenberg based front end effects the most likely result will be the same "bloated" HTML CSS and JS as gutenberg does.

The right way to think about gutenber is as a fancy UI to manage shortcodes in documents. Any one that has any experiance with documents which have an excessive number of shortcodes know that it is not trivial to remove them. Maybe if you have mostly text you can remove the gutenberg dependencies but if you have many article it is probably hard to be sure which ones do not use any gutenberg features.

The way forward:

  1. Call the posts that were already done with gutenberg as a "sunk cost" admit to yourself you will keep editting them with gutenberg until the end of time.
  2. Use some taxonomy term or add meta field to all those posts. Write a plugin that disables gutenberg for all posts that do not have that term associated with them
  3. Rewrite the content of the posts in which the bloat actually matters (can't be that all your posts have to have a score of 90+) and remove the association with the term from them
发布评论

评论列表(0)

  1. 暂无评论