對(duì)于WordPress主題和插件的二次開(kāi)發(fā),我們需要對(duì)其文件和數(shù)據(jù)庫(kù)了解。在這里,我們看看默認(rèn)WordPress數(shù)據(jù)庫(kù)中各個(gè)字段的作用和含義整理。
常見(jiàn)字段:
wp_commentmeta:存儲(chǔ)Akismet或手工審核的評(píng)論是否為垃圾評(píng)論的判斷結(jié)果; wp_comments:存儲(chǔ)評(píng)論信息,如評(píng)論內(nèi)容、評(píng)論所屬文章、評(píng)論人昵稱(chēng)、郵箱、URL等; wp_links:存儲(chǔ)友情鏈接信息,如友鏈名稱(chēng)、URL、打開(kāi)方式、描述、是否可見(jiàn)等; wp_options:存儲(chǔ)WordPress系統(tǒng)默認(rèn)及后臺(tái)系統(tǒng)選項(xiàng)、插件及主題配置信息,包括網(wǎng)站標(biāo)題、副標(biāo)題、當(dāng)前主題等等; wp_postmeta:存儲(chǔ)文章的一些相關(guān)信息,如文章附件圖片的alt信息、文章所在分類(lèi)的URL以及文章自定義的自定義字段,其中可能就有文章訪(fǎng)問(wèn)次數(shù)等; wp_posts:存儲(chǔ)文章信息,包括文章標(biāo)題、正文、摘要、作者、發(fā)布時(shí)間、訪(fǎng)問(wèn)密碼、評(píng)論數(shù)、修改時(shí)間、文章地址等; wp_termeta:存儲(chǔ)對(duì)菜單分類(lèi)的更多設(shè)置,屬于開(kāi)發(fā)性功能居多,例如分類(lèi)目錄的縮略圖、顏色標(biāo)識(shí)等; wp_terms:存儲(chǔ)菜單分類(lèi)、標(biāo)簽分類(lèi)名稱(chēng)及URL信息; wp_term_relationships:存儲(chǔ)文章和分類(lèi)、標(biāo)簽的相互對(duì)應(yīng)關(guān)系; wp_term_taxonomy:存儲(chǔ)分類(lèi)和標(biāo)簽的描述信息、父子關(guān)系、所屬包含的文章數(shù)等; wp_usermeta:存儲(chǔ)用戶(hù)的姓名、昵稱(chēng)、權(quán)限等信息; wp_users:存儲(chǔ)用戶(hù)名、密碼、昵稱(chēng)、郵箱、注冊(cè)時(shí)間等信息;
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)論類(lèi)型(pingback/普通) comment_parent:父評(píng)論ID user_id:評(píng)論者用戶(hù)ID(未登錄用戶(hù)的評(píng)論則為空
wp_links
link_id:自增唯一ID link_url:鏈接URL link_name:鏈接標(biāo)題 link_image:鏈接圖片 link_target:鏈接打開(kāi)方式 link_description:鏈接描述 link_visible:是否可見(jiàn)(Y/N) link_owner:添加者用戶(hù)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,用于多用戶(hù)博客,默認(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īng)顟B(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過(guò)的鏈接 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:文章類(lèi)型(post/page等) post_mime_type:MIME類(lèi)型 comment_count:評(píng)論總數(shù)
wp_termeta
meta_id:自增唯一ID term_id:分類(lèi)ID meta_key:鍵名 meta_value:鍵值
wp_terms
term_id:分類(lèi)ID name:分類(lèi)名 slug:縮略名 term_group:分組
wp_term_relationships
object_id:對(duì)應(yīng)文章ID/鏈接ID term_taxonomy_id:對(duì)應(yīng)自定義分類(lèi)ID term_order:排序
wp_term_taxonomy
term_taxonomy_id:自定義分類(lèi)ID term_id:分類(lèi)ID taxonomy:分類(lèi)(category/post_tag) description:分類(lèi)描述 parent:所屬父分類(lèi)ID count:文章數(shù)統(tǒng)計(jì)
wp_usermeta
umeta_id:自增唯一ID user_id:對(duì)應(yīng)用戶(hù)ID meta_key:鍵名 meta_value:鍵值
wp_users
ID:自增唯一ID user_login:登錄名 user_pass:密碼 user_nicename:昵稱(chēng) user_email:Email user_url:網(wǎng)址 user_registered:注冊(cè)時(shí)間 user_activation_key:激活碼 user_status:用戶(hù)狀態(tài) display_name:顯示名稱(chēng)
評(píng)論