WordPress 数据库结构及表字段作用解析
對(duì)于WordPress的開發(fā)可以說子凡已經(jīng)是如癡如醉了,通過 WordPress 本身的開放性接口可以做到很多的事情,但是有些時(shí)候我們可能更喜歡直接查詢數(shù)據(jù)庫來實(shí)現(xiàn)某些 WordPress 沒有提供的函數(shù)來實(shí)現(xiàn)目的,所以這時(shí)候我們就需要對(duì)WordPress 數(shù)據(jù)庫的結(jié)構(gòu)和字段作用需要了解,這樣才有利于做深度的使用和開發(fā)。
子凡今天之所以想著要整理一份 WordPress 數(shù)據(jù)庫表結(jié)構(gòu)的詳細(xì)說明,其實(shí)是因?yàn)橛邢肟紤]在 WordPress 的某張表里新增一個(gè)字段,來實(shí)現(xiàn)某些特殊的定制化數(shù)據(jù)的存儲(chǔ),雖然數(shù)據(jù)表中的字段命名都非常規(guī)范和準(zhǔn)確,大多數(shù)通過字段名就可以知道是什么作用,不過其中有些字段還真不知道具體用處,就顯得非常的尷尬了,所以就通過 WordPress 官方和,整理出來,方便自己以后的使用和提供給大家有個(gè)參考。
WordPress 數(shù)據(jù)表作用介紹
首先分別來先看看 WordPress 所有的數(shù)據(jù)表都是干什么用的吧,一下是 WordPress 完整的 12 張數(shù)據(jù)表,當(dāng)然剛安裝好的時(shí)候一般是只有 11 張表的,如果還有其它相關(guān)的數(shù)據(jù)庫,那么可能就不是 WordPress 本身的數(shù)據(jù)庫,有可能是某些主題或插件需要而創(chuàng)建的,所以一下肯定子凡要介紹的還是 WordPress 本身的數(shù)據(jù)庫表和字段了。
wp_commentmeta
- meta_id:自增唯一 ID
- comment_id:評(píng)論 ID
- meta_key:鍵名
- meta_value:鍵值
wp_comments
- comment_ID:自增唯一 ID
- comment_post_ID:對(duì)應(yīng)文章 ID
- comment_author:評(píng)論者
- comment_author_email:評(píng)論者郵箱
- comment_author_url:評(píng)論者網(wǎng)址
- comment_author_IP:評(píng)論者 IP
- comment_date:評(píng)論時(shí)間
- comment_date_gmt:評(píng)論時(shí)間(GMT+0 時(shí)間)
- comment_content:評(píng)論正文
- comment_karma:未知
- comment_approved:評(píng)論是否被批準(zhǔn)
- comment_agent:評(píng)論者的 USER AGENT
- comment_type:評(píng)論類型(pingback/普通)
- comment_parent:父評(píng)論 ID
- user_id:評(píng)論者用戶 ID(未登錄用戶的評(píng)論則為空
wp_links
- link_id:自增唯一 ID
- link_url:鏈接 URL
- link_name:鏈接標(biāo)題
- link_image:鏈接圖片
- link_target:鏈接打開方式
- link_description:鏈接描述
- link_visible:是否可見(Y/N)
- link_owner:添加者用戶 ID
- link_rating:評(píng)分等級(jí)
- link_updated:未知
- link_rel:XFN 關(guān)系
- link_notes:XFN 注釋
- link_rss:鏈接 RSS 地址
wp_options
- option_id:自增唯一 ID
- blog_id:博客 ID,用于多用戶博客,默認(rèn) 0
- option_name:鍵名
- option_value:鍵值
- autoload:WordPress 加載時(shí)自動(dòng)載入(yes/no)
wp_postmeta
- meta_id:自增唯一 ID
- post_id:對(duì)應(yīng)文章 ID
- meta_key:鍵名
- meta_value:鍵值
wp_posts
- ID:自增唯一 ID
- post_author:對(duì)應(yīng)作者 ID
- post_date:發(fā)布時(shí)間
- post_date_gmt:發(fā)布時(shí)間(GMT+0 時(shí)間)
- post_content:正文
- post_title:標(biāo)題
- post_excerpt:摘錄
- post_status:文章狀態(tài)(publish/auto-draft/inherit 等)
- comment_status:評(píng)論狀態(tài)(open/closed)
- ping_status:PING 狀態(tài)(open/closed)
- post_password:文章密碼
- post_name:文章縮略名
- to_ping:未知
- pinged:已經(jīng) PING 過的鏈接
- post_modified:修改時(shí)間
- post_modified_gmt:修改時(shí)間(GMT+0 時(shí)間)
- post_content_filtered:未知
- post_parent:父文章,主要用于 PAGE
- guid:唯一標(biāo)識(shí)符(短鏈接)
- menu_order:排序 ID
- post_type:文章類型(post/page 等)
- post_mime_type:MIME 類型
- comment_count:評(píng)論總數(shù)
wp_termeta
- meta_id:自增唯一 ID
- term_id:分類 ID
- meta_key:鍵名
- meta_value:鍵值
wp_terms
- term_id:分類 ID
- name:分類名
- slug:縮略名
- term_group:分組
wp_term_relationships
- object_id:對(duì)應(yīng)文章 ID/鏈接 ID
- term_taxonomy_id:對(duì)應(yīng)自定義分類 ID
- term_order:排序
wp_term_taxonomy
- term_taxonomy_id:自定義分類 ID
- term_id:分類 ID
- taxonomy:分類(category/post_tag)
- description:分類描述
- parent:所屬父分類 ID
- count:文章數(shù)統(tǒng)計(jì)
wp_usermeta
- umeta_id:自增唯一 ID
- user_id:對(duì)應(yīng)用戶 ID
- meta_key:鍵名
- meta_value:鍵值
wp_users
- ID:自增唯一 ID
- user_login:登錄名
- user_pass:密碼
- user_nicename:昵稱
- user_email:Email
- user_url:網(wǎng)址
- user_registered:注冊(cè)時(shí)間
- user_activation_key:激活碼
- user_status:用戶狀態(tài)
- display_name:顯示名稱
寫在最后
以上便是子凡參考 WordPress 官方和實(shí)際 WordPress 數(shù)據(jù)庫而整理并標(biāo)注的一些信息,其中有些數(shù)據(jù)表中的字段無法確定,或者其中有些字段在新版的 WordPress 中已經(jīng)幾乎未在使用,例如 wp_users 表中的 user_status 用戶狀態(tài)字段就沒有使用。所以以上內(nèi)容僅供簡單查閱和參考,并且子凡也無法保證時(shí)刻與 WordPress 最新版本保持一致,當(dāng)然如果你有新的發(fā)現(xiàn)或者不同,歡迎在淚雪博客本文底部留言,子凡驗(yàn)證后可以做及時(shí)更新。
除非注明,否則均為淚雪博客原創(chuàng)文章,轉(zhuǎn)載請(qǐng)以鏈接形式標(biāo)明本文地址
本文鏈接:https://zhangzifan.com/wordpress-database.html
總結(jié)
以上是生活随笔為你收集整理的WordPress 数据库结构及表字段作用解析的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 单摆的动力学建模以及matlab仿真(牛
- 下一篇: Mysql不同存储引擎的表转换方法