1

Let me start off by saying that I have no WordPress experience at all so I may be asking a really stupid question. What I need to do is transfer a bunch of articles from a old MySQL database to a WordPress site.

Now I found wp_insert_post and I can get all the data from the old DB. The problem starts with the article images. In the WordPress DB there seems to be a <figure class="wp-block-image size-large"><img src="hard path to image here" alt="" class="wp-image-4066"/></figure> tag that points to the exact image. Problem is that it is surrounded by, what I would call strange comments, that look like this :

<!-- wp:image {"id":4066,"sizeSlug":"large"} -->
<!-- /wp:image -->

This id seems to be the ID of the image that is made a attachment type post in the same table. My question is are these comments necessary or can I just generate the tag ?

1

Those comments have been added by the Gutenberg block editor. If you remove them you'll no longer be able to edit those blocks in the admin using Gutenberg.

3
  • but will WordPress display the page as it is? Since I need to transfer old articles being able to edit them is not a concern. – Uri Popov Oct 27 '20 at 9:16
  • If they're standard blocks they should still display correctly even without the comments, yes. – vancoder Oct 27 '20 at 15:01
  • Thank you very much :) – Uri Popov Oct 27 '20 at 17:58

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.