0

I want to put in theme admin page an option for demo content XML.

This option should offer the possibility to switch between Demo Content and Default WordPress installation content. If I select demo, I want to show Demo content from my XML file. If select default I want to show what I have already posted, not the imported XML content.

1 Answer 1

0

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. :)

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.