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 Make a Website with WordPress Installing WordPress The Famous 5-Minute WordPress Install

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

why we need to create database in wordpress ??

I am still confused why we need to create database ?? and what happen if we don't ??? thanks :)

3 Answers

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,253 Points

Everything that happens behind the scenes... every post you write, every page you make, every theme you develop in Wordpress is stored in a mySQL database. Every dynamic application has to have a database driving it.

Databases are like "memory" for websites.

Once you set up your database when you install Wordpress it will do the rest. :-)

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

OOkaaay thankyou :)

If i create a custom post type, How it saved in database, which table, how?

After installing some plugin there is a autometic table in wordpress. Like Woocommerce. How it happen?

Rifqi Fahmi
Rifqi Fahmi
23,164 Points

I think it dynamically create table based on situatuon you are facing with PHP and mySql language work together and store it to database... Dunno Lol #newbie too here

Jonathan Grieve
Jonathan Grieve
Treehouse Moderator 91,253 Points

I'm not sure precisely but I think it'd be stored somewhere in your wp-content folder in your WordPress installation. But it will be somewhere in there :)

Kevin Korte
Kevin Korte
28,149 Points

Wordpress won't work. It'll forever error with a Error establishing database connection. It has to have a mysql database to access.

In regards to plugins, plugins can and will add more tables to your database when you activate them, if the plugin needs so. It can run sql commands to do so. Custom post types are stored in the wp_posts table, with all of the other posts. Wordpress tracks a post type in the database, so although all the posts are in one table, wordpress knows the post's type via a column in the database.

Thanks you very much.

Konrad Pilch
Konrad Pilch
2,435 Points

If you do some pure PHP , and get into PHP functions and MySQL , you will exactly understand how it works. The WP databse is already made for you by others, as well as lots of the core WP code is written by others.