Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up
for free
Mauricio Gelves - WordPress Database: What’s behind those 12 tables - WordCamp Athens 2016
WordPress Greek Community
November 19, 2016
Programming
2
180
Mauricio Gelves - WordPress Database: What’s behind those 12 tables - WordCamp Athens 2016
WordPress Greek Community
November 19, 2016
Tweet
Share
More Decks by WordPress Greek Community
See All by WordPress Greek Community
wpgr
0
250
wpgr
0
88
wpgr
1
99
wpgr
0
120
wpgr
0
55
wpgr
0
58
wpgr
0
39
wpgr
0
24
wpgr
0
33
Other Decks in Programming
See All in Programming
standfm
0
210
hanakla
2
3k
nbkouhou
9
4.5k
malvinstn
1
620
kazuki19992
0
440
itosho525
0
130
viteinfinite
0
140
mizdra
7
4.8k
horie1024
1
330
77web
0
210
yamotuki
0
120
dictoss
0
160
Featured
See All Featured
deanohume
295
27k
lara
590
61k
maltzj
500
36k
jponch
103
4.9k
cromwellryan
101
5.9k
philnash
8
490
ufuk
56
5.4k
nonsquared
81
3.3k
vanstee
116
4.8k
62gerente
587
200k
philhawksworth
192
8.8k
marcelosomers
220
15k
Transcript
WordPress Database: What’s behind those 12 tables? Mauricio Gelves |
@maugelves
Do you know this Masterpiece?
None
None
None
A love story
None
Set of columns Data types Indexes The table anatomy
Table rows
I’m Rebel!
Normalization
Process to avoid: • Data redundancy • Unnecessary updates •
Data integrity problems
None
None
None
None
None
WordPress code of conduct: No political jokes are allowed
UPDATE tbl_students SET president = '<new president name>' WHERE president
= 'Prokopis Pavlopoulos' On every change:
Normalized tables: FK’s (Foreign Keys)
¿Is WordPress Rebel?
• wp-posts • wp-term-taxonomy
None
None
None
33,3333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333 333333333333333333333333333333333333333
333333333333333333333333333333333333333 333333333333333333333333333333333333…%
¿Why WordPress powers 26% of all websites?
ES FLEXIBLE
KEY => VALUE
wp_posts WordPress’ Heart.
wp_posts
¿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
KEY VALUE => Usuarios
SHE ’S ORGANIZED
KEY VALUE => wp_options
SHE’S ADAPTABLE
Taxonomies
Taxonomías Simple terms Which taxonomy has?
Es muy fácil comunicarse con ella: Diapositiva: una mujer con
un teléfono It’s easy to talk to her
SQL Structured Query Language
Estructura de consulta: 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?
WP_Query
None
None
None
CUSTOM TABLES How 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
None
How to create a Custom Tables?: • Create it on
plugin/theme activation • UI implementation with WP_List class
None
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! @maugelves