I’m creating a plugin similar to https://www.wpbeaverbuilder.com/
You can drag & drop elements to create layouts, etc.

What would be the best way to store post content in this case? Ideally it shouldn’t be lost after disabling the plugin.

Current options are:

  • save to WP_POSTS table as shortcodes
  • create my own table, store there in JSON, and then populate WP_POSTS table with generated HTML

I don’t like both, because shortcodes will make it hard to switch as you’re bound to generated shortcodes (though you’ll have a workaround there).
HTML is fine until user needs to make edits.

2 Answers
2

The only reasonably portable option is to store content in post content.

Anything else (be it shortcodes, post meta, or options) will need a custom code to access and display it, either yours or some other if site parts way with your plugin.

The reasonable approach for data portability I’ve seen is storing a certain amount of generated HTML together with content (which would keep content available and visible by itself) and progressively enhancing it when “builder” code is active and running for full effect.

Leave a Reply

Your email address will not be published. Required fields are marked *