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 would like to try build a simple plugin that collects and stores the name and email address of the person who filled in the form. I realize there are probably dozens of plugins out there that do this already but would like to build my own, for practice.

If the user enters their name and email address, where should this be stored? Should it be created as a "subscriber" custom post type or a whole new table in the WP database? What are your thoughts? I'd like to eventually export the data to a .csv file if that influences where it should be stored.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

There are multiple storage mechanisms in WP so it can be bit tricky to pick one and sometimes there is no single right choice.

Let's examine your criteria for storage:

  • persistent (you don't want data just evaporating)
  • processable (you want to export it and probably navigate)
  • simple to implement (you don't want go building something (semi)custom just for the heck of it)
  • extensible (in case you want to capture more data down the road and such)

As for me the best storage to satisfy these condition would be using custom post type. It comes with a lot of functionality out of the box (like admin interface), requires no messing with storage (custom tables or whatever) and is perfectly suited to store arbitrary information in custom fields.

share|improve this answer
    
Good points. I think I'll try with this route. Thanks –  Andrew Oct 10 '12 at 1:23

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.