0

I'm building a theme and I have a custom page template with a <form> which is for the vistors to fill in and submit. I'm processing the data with help from hooks and this is all separated from the template file.

I've come to the moment where I have to save the data to the database. What are the best practises when it comes to saving custom form data for a theme developer? I'm expecting at least a thousand of form submissions and about ten different field data to be saved.

Should I

  1. Create a separate db table and use $wpdb to save/retrieve data
  2. Create a custom post and create an entry for every form submission
  3. Something way smarter (up to you)
0

It depends upon the requirement how the form submission entries is going to work afterwards.

  1. if you want to collect info from front end and log them to database (with listing in admin panel), separate db table could be the way.
  2. if you want to display the data submitted in the form to the front end users, you should use custom post type as it will be easier to use WP_Query and add filter to include them in archives, search results etc.

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.