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 WordPress for Website Owners WordPress Community Management Forms on Your WordPress Site

huckleberry
huckleberry
14,636 Points

Forms: What About Databases?

Ok so, WordPress doesn't have native options to allow you to create forms such as contact forms or signing up.

Plugins do that.

What wasn't addressed and what I don't understand is... don't you have to have a database set up for that stuff? If I go and buy this Gravity Forms or even if under a shoestring I decide to go with a free thingy like Ninja Forms, am I not putting the cart before the horse? Do I not need to have a DB set up? Or... or am I missing a part of the picture? Does WordPress automatically set up a DB on your directory when you install it and then those plugins directly interact with said DB?

Or ... or do the plugins actually create and then handle the DB?

Or is it just expected that you know about DB's and have already established one on your server and now the plugin just interacts with said DB?

I dunno but I'm confused here.

Thanks!!

2 Answers

Sue Dough
Sue Dough
35,800 Points

A database will automatically be installed if your doing one click installs through hosting companies. The default wordpress tables will be created. New plugins MAY create new tables but NOT always. Here is a list of default tables.

wp_commentmeta : This table contains meta information about comments posted on a WordPress website. This table has four fields meta_id, comment_id, meta_key, and meta_value. Each meta_id is related to a comment_id. One example of comment meta information stored is the status of comment (approved, pending, trash, etc).

wp_comments : As the name suggests this table contains your WordPress comments. It contains comment author name, url, email, comment, etc.

wp_links : To manage blogrolls create by earlier versions of WordPress or the Link Manager plugin.

wp_options : This table contains most of your WordPress site wide settings such as: site url, admin email, default category, posts per page, time format, and much much more. The options table is also used by numerous WordPress plugins to store plugin settings.

wp_postmeta : This table contains meta information about your WordPress posts, pages, and custom post types. Example of post meta information would be which template to use to display a page, custom fields, etc. Some plugins would also use this table to store plugin data such as WordPress SEO information.

wp_posts : The name says posts but actually this table contains all post types or should we say content types. This table contains all your posts, pages, revisions, and custom post types.

wp_terms : WordPress has a powerful taxonomy system that allows you to organize your content. Individual taxonomy items are called terms and they are stored in this table. Example, your WordPress categories and tags are taxonomies, and each category and tag inside them is a term.

wp_term_relationships : This table manages relationship of WordPress post types with terms in wp_terms table. For example this is the table that helps WordPress determine post X is in Y category.

wp_term_taxonomy : This table defines taxonomies for terms defined in wp_terms table. For example if you have a term “WordPress Tutorials“, then this table contains the data that says it is associated with a taxonomy categories. In short this table has the data that helps WordPress differentiate between which term is a category, which is a tag, etc.

wp_usermeta : Contains meta information about Users on your website.

wp_users : Contains User information like username, password, user email, etc.


Plugins do not always create database tables. A lot do not. The plugin author has to do that. Some contact plugins do not require any new database tables. Some do so the data can be saved.

For example a lot of contact plugins do not log the data in the database out of the box. Check out this plugin https://wordpress.org/plugins/contact-form-7-to-database-extension/ if your interested in doing so.

Sue Dough
Sue Dough
35,800 Points

To see your database go to your wp-config.php file and check the database name. Then go to PHPmyadmin in cpanel. Then you can view your database and tables associated with it.

huckleberry
huckleberry
14,636 Points

wow! What a fantastic answer dude... I don't know much about db's as it is right now but I'm bookmarking this to refer to over the weekend and study this stuff.

I did do the one click install and ran a test on a user signing up and everything works fine so I guess the default db got installed and all that but I need to learn more so I'm more comfy knowing what I'm looking at.

thanks a ton!

Cheers,

Huck - :sunglasses:

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

I'm no expert on Wordpress, yet ;) But I do think you'll need a web host that gives you database access. In my experience Hosts will offer Wordpress with their package alongside databases so it goes hand in hand. :-)

huckleberry
huckleberry
14,636 Points

Hmm, well, my two hosting companies both offer databases (I would honestly be blown away if a company did not have that available... would they even survive? lol), and they both have WP along with the whole oneclick install.

I use dreamhost for one site that I set up a while ago but never "got to" until just recently when I decided to go the WordPress route in order to get moving on my business, and just recently -- when I began the WordPress track -- I set up another site on webhostingforstudents which is my portfolio and project site. It'll serve the purpose of learning WordPress and using it to post my projects that I'm working on as I learn web design and development here on TTh.

So everything is already set up... I'm fully rockin', got my themes and some assorted plugins and yadda yadda and now I've just finished the WordPress for Website Owners course and will probably have the full Learn WordPress track done by the end of the day... however, there are still gaps.

You say they go hand in hand but what I'm confused about is this...

When you install WordPress, does that automatically hook up with or integrate or whatever it's called, with the available database on your server? Or do you have to go in and configure that? I mean, with the scope of how awesome this whole WordPress thing is I'm just assuming that yes, when you install, it links up with whatever DB is available on your server and from there on it's literally nothing you have to worry about, but I don't know...

Is this covered in later WP courses and stages or is that only covered in the development track?

Thanks for your reply and any help you can offer in regard to my further questions!

Cheers,

Huck - :sunglasses:

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

Hey huck...

So a month has gone by and you've probably moved on by now but I started the Wordpress track a couple of days ago. :)

But anyway, as far as I'm aware Wordpress installation whether it's one click install or manual will install all the neccessary tables for comments and pages and the like. When I set up my wordpress site the other day I was asked to name my databases and prefixes for my tables. Beyond that I just assume any other actions you take on the backend are handled behind the scenes so if a new database table is needed it should be added.

Sorry it's taken so long to respond. :)

huckleberry
huckleberry
14,636 Points

Jonny Grieves!... Madcap!... Where you goin' with that shotgun?

o_O?

Anyway... nope, haven't moved on yet. I finished the track and all and know how to move in & around as well as operate my site but some other things cropped up and that sort of got put on hold so I actually haven't gone back and explored the nuances of the database handling and all of that good stuff. I'll need to shortly though as I'll be needing to setup an e-commerce site and it's between Shopify or WP wooCommerce and if the 2nd is my choice, proooobably gonna know my databases lol.

Thanks for the reply... your memory(or your dedication to follow up) is impressive.

Cheers,

Huck - :sunglasses:

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,252 Points

I think for me all that will come when I move onto the Wordpress Development site. I haven't done anything on databases yet either but i think that will come as I move further into my Treehouse Education.

This is actually my second experience with using a CMS. I used OpenCart to build an ecommerce site for a client a couple of months ago so in the past few months I've gone up in a world a little bit :)