WordPress Database: What’s behind those 12 tables?
Mauricio Gelves | @maugelves
Do you know this Masterpiece?
@takisbig Athens, 2016
Set of columnsData typesIndexes
The table anatomy
Process to avoid:
• Data redundancy • Unnecessary updates • Data integrity problems
Process to avoid:
• Data redundancy • Unnecessary updates • Data integrity problems
WordPress code of conduct:No political jokes are allowed
UPDATE tbl_students SET president = '<new president name>' WHERE president = 'Prokopis Pavlopoulos'
On every change:
Process to avoid:
• Data redundancy • Unnecessary updates • Data integrity problems
Normalized tables:
FK’s (Foreign Keys)
Is WordPress Rebel?
• wp-posts
• wp-term-taxonomy
33,3333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333333…%
Why WordPress powers 27% of all websites?
wp_posts WordPress Heart.
Where’s the rest of the information?
Meta Tables
wp_posts => wp_postmeta wp_users => wp_usermeta
wp_comments => wp_commentmeta wp_terms => wp_termmeta
KEY VALUE=>
wp_posts
wp_postmeta
KEY VALUE=>
wp_users
wp_usermeta
KEY VALUE=>
wp_options
Taxonomies
Terms list
Sets the taxonomy name
Es muy fácil comunicarse con ella: Diapositiva: una mujer con un teléfono
It’s easy to talk to her
SQLStructured Query Language
Query structure:Which column/s?
Which table/s?
Should we filter the search?
Do we have to know SQL to work with WordPress?
WordPress Functions:
What if we need Meta values?
WordPress Functions:
and for more complex searches?
CUSTOM TABLESHow and why?
Why Custom Tables?:
• Efficiency (Inner joins) • Efficiency (calculated fields) • Space (uncompleted fields) • Data security
How to create a Custom Tables?:• Create it on plugin/theme activation
How to create a Custom Tables?:• Create it on plugin/theme activation • UI implementation with WP_List class
http://wpengineer.com/2426/wp_list_table-a-step-by-step-guide/
Because of this and more I’m in love with the
WordPress database.
Thank you!
Mauricio Gelves @maugelves - maugelves.com