WordPress 数据库表结构
像素鱼丸
2024-05-04
531
0

WordPress 一共有以下12个表,默认表前缀是 “wp_”

wp_commentmeta 存储评论的元数据

meta_id:自增唯一ID
comment_id:对应评论ID
meta_key:键名
meta_value:键值

wp_comments 存储评论

comment_ID:自增唯一ID
comment_post_ID:对应文章ID
comment_author:评论者
comment_author_email:评论者邮箱
comment_author_url:评论者网址
comment_author_IP:评论者IP
comment_date:评论时间
comment_date_gmt:评论时间(GMT+0时间)
comment_content:评论正文
comment_karma:未知
comment_approved:评论是否被批准
comment_agent:评论者的USER AGENT
comment_type:评论类型(pingback/普通)
comment_parent:父评论ID
user_id:评论者用户ID(不一定存在)

wp_links 存储友情链接

link_id:自增唯一ID
link_url:链接URL
link_name:链接标题
link_image:链接图片
link_target:链接打开方式
link_description:链接描述
link_visible:是否可见(Y/N)
link_owner:添加者用户ID
link_rating:评分等级
link_updated:未知
link_rel:XFN关系
link_notes:XFN注释
link_rss:链接RSS地址

wp_options 存储WordPress系统选项和插件、主题配置

option_id:自增唯一ID
blog_id:博客ID,用于多用户博客,默认0
option_name:键名
option_value:键值
autoload:在WordPress载入时自动载入(yes/no)

wp_postmeta 存储文章(包括页面、上传文件、修订)的元数据

meta_id:自增唯一ID
post_id:对应文章ID
meta_key:键名
meta_value:键值

wp_posts 存储文章(包括页面、上传文件、修订)

ID:自增唯一ID
post_author:对应作者ID
post_date:发布时间
post_date_gmt:发布时间(GMT+0时间)
post_content:正文
post_title:标题
post_excerpt:摘录
post_status:文章状态(publish/auto-draft/inherit等)
comment_status:评论状态(open/closed)
ping_status:PING状态(open/closed)
post_password:文章密码
post_name:文章缩略名
to_ping:未知
pinged:已经PING过的链接
post_modified:修改时间
post_modified_gmt:修改时间(GMT+0时间)
post_content_filtered:未知
post_parent:父文章,主要用于PAGE
guid:未知
menu_order:排序ID
post_type:文章类型(post/page等)
post_mime_type:MIME类型
comment_count:评论总数

wp_term_relationships

object_id:对应文章ID/链接ID
term_taxonomy_id:对应分类ID
term_order:排序

wp_term_taxonomy

term_taxonomy_id:分类方法ID
term_id:taxonomy:分类方法(category/post_tag)
description:未知
parent:所属父分类方法ID
count:文章数统计

wp_termsmeta:存储目录、标签的元数据

meta_id:wp_termmeta 表ID
term_id:对应 wp_terms表中 的ID
meta_key:属性键名
meta_value:属性键值

wp_terms 存储每个目录、标签

term_id:分类ID
name:分类名
slug:缩略名
term_group:未知

wp_usermeta 存储用户的元数据

umeta_id:自增唯一ID
user_id:对应用户ID
meta_key:键名
meta_value:键值

wp_users 用户表

ID:自增唯一ID
user_login:登录名
user_pass:密码
user_nicename:昵称
user_email:Email
user_url:网址
user_registered:注册时间
user_activation_key:激活码
user_status:用户状态
display_name:显示名称
收藏
打赏
WP_Query 函数
上一篇
WordPress 插件开发
下一篇

发表评论

注册不是必须的

像素鱼丸
150 文章
0 评论
4 喜欢
最新文章

宝塔 Nginx 拦截了 WordPress 返回 404 的状态

REST api 接口中,有段代码返回404,但是没有正常返回错误json: $wp_response = new \WP_REST_Response(array('error'=>'没有找到数据')); $wp_response->set_status(404); return $wp_response; 返回内容是: <html> <head><tit […]

Mirage 主题 v2.93.0 发布

更新内容: refactor 移除图片高宽比开关 refactor 移除全局的TOC生成开关 refactor 优化 header.php 中的seo模块和样式覆盖 feat 主题启用的时候,移除非当前主题注册的小工具 fix 修复分类小工具的bug feat 管理员打开后台,检查最当前设置首页布局的模块,如果缺少最新模块,就添加到隐藏模块列表中 fix 优化链接卡片样式 fix 优化热门文章样式 […]

如何使用 WordPress Setting API

使用 WordPress 的 Setting API 是在插件或主题中创建和管理设置页面的标准方式。它提供了一种结构化、安全的方式来保存和获取用户配置的选项。 ✅ 一、Setting API 简介 WordPress 的 Setting API 允许你: 创建设置页面(Settings Page) 注册设置字段(Settings Field) 验证和保存设置数据 使用表单提交来更新设置 ✅ 二、基 […]

详解 WordPress 的评论设置

好的,我们来详细梳理并总结 WordPress 中关于文章评论的两个核心控制层级:全局设置和单篇设置。理解这两者的关系(优先级)是管理网站评论的关键。 1. 全局设置 (Global Settings) —— 网站的“默认规则” 这是整个网站评论系统的总开关和默认行为准则。它决定了新发布的文章默认是什么样子的。 位置:WordPress 后台仪表盘 -> 设置 (Settings) -> […]
生成中...
扫描二维码
扫描二维码
用户登录