How to create import option for xml

Sound like an interesting, but I think it would be very difficult, because content is more than just posts:

  • Post authors for the demo content must match existing users.
  • Taxonomies (tags, categories, nav menus) are bound to existing content.
  • Comments need proper associations with post IDs and post types.

One way to do what you want:

  • Create copies of the existing tables (posts, post_meta, comments, taxonomy tables) with a different prefix.
  • Filter query and replace the table names when you want to show the demo content.
  • During import, map existing users to the new content.

There are probably a billion ways how this can break. Multi-site and unusual database setups are obvious. 🙂