Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.