Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress How to Build a WordPress Plugin Building a WordPress Plugin Settings Page CRUD with the WordPress Options Table

Saving and retrieving data

I been following this tutorials on how to create wordpress plugin, but i did not understand how to save data into a table, from admin e.g asking some questions and then on the front end displaying it by pulling from database. e.g, I have posted a question of Multiple Choice Question from backend, how will it save to database and on frontend, how will it show on frontend, and when a user select a question/answer it, how will it store in database?

Right now i got concept of CRUD i.e add_option , update_option , get_option but in sql we use CRUD. like Insert , update , Delete.

So to put in simple words, I want questions posted with multiple choices, that should have a image upload option too. On frontend, the user select any answer from the questions. When he clicks next, it saves into the database. How is that possible with add,update etc?

1 Answer

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi,

If you are doing something like a quiz plugin you may want to look into saving your content or question as custom post types. Most powerful plugins that need to manage data in the database wouldn't store it in the options table. Rather they would try to fold the content into WordPress' traditional content options, particularly custom post types, or create their own tables in the database (less supported if not really needed).

Hi, So any tutorial for that (on treehouse or net), on how to do so for newbie? Or does this tutorial shows how.