由于WordPress自己与数据库接口,作为终端用户,不必过分担心它的结构。而如果你是在编写插件,你也许会对学习如何直接与数据库接口感兴趣。WordPress提供了wpdb类简化了这一过程。
数据库图表
下面的图表提供了一个图形化的WordPress数据库概览,以及在WordPress(WordPress2.5+)标准安装过程中创建的表之间的关系。以下的数据表概览包含了表和列的额外详细说明。
请注意,在wp的标准安装过程中表之间的完整性不是强制性的,比如文章和评论之间。如果你正在创建操作数据库的插件或扩展,你的代码应该做些清理工作,以便没有无用的记录留在表里。比如当外键被删除时,使用一个SQL命令集来删除其它表中的数据(不要忘记提醒用户,在进行此类操作前进行备份)。
表概述
这一节是在wp标准安装过程中创建的所有数据表的概述。详细内容在以下各表中。
表详细资料
以下是在wp标准安装过程中创建的数据表每个字段的详细信息。
Table: wp_commentmeta
Field
Type
Null
Key
Default
Extra
meta_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
comment_id |
bigint(20) unsigned |
|
IND |
0 |
FK->wp_comments.comment_id |
meta_key |
varchar(255) |
YES |
IND |
NULL |
|
meta_value |
longtext |
YES |
|
NULL |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
0 |
meta_ID |
comment_id |
INDEX |
none |
comment_id |
meta_key |
INDEX |
none |
meta_key |
Table: wp_comments
Field
Type
Null
Key
Default
Extra
comment_ID |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
comment_post_ID |
bigint(20) unsigned |
|
IND |
0 |
FK->wp_posts.ID |
comment_author |
tinytext |
|
|
|
|
comment_author_email |
varchar(100) |
|
|
|
|
comment_author_url |
varchar(200) |
|
|
|
|
comment_author_IP |
varchar(100) |
|
|
|
|
comment_date |
datetime |
|
|
0000-00-00 00:00:00 |
|
comment_date_gmt |
datetime |
|
IND & IND Pt2 |
0000-00-00 00:00:00 |
|
comment_content |
text |
|
|
|
|
comment_karma |
int(11) |
|
|
0 |
|
comment_approved |
varchar(20) |
|
IND & Ind Pt1 |
1 |
|
comment_agent |
varchar(255) |
|
|
|
|
comment_type |
varchar(20) |
|
|
|
|
comment_parent |
bigint(20) unsigned |
|
|
0 |
FK->wp_comments.ID |
user_id |
bigint(20) unsigned |
|
|
0 |
FK->wp_users.ID |
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
1 |
comment_ID |
comment_approved |
INDEX |
None |
comment_approved |
comment_post_ID |
INDEX |
None |
comment_post_ID |
comment_approved_date_gmt |
INDEX |
None |
comment_approved comment_date_gmt |
comment_date_gmt |
INDEX |
None |
comment_date_gmt |
comment_parent |
INDEX |
None |
comment_parent |
Table: wp_links
Field
Type
Null
Key
Default
Extra
link_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
link_url |
varchar(255) |
|
|
|
|
link_name |
varchar(255) |
|
|
|
|
link_image |
varchar(255) |
|
|
|
|
link_target |
varchar(25) |
|
|
|
|
link_description |
varchar(255) |
|
|
|
|
link_visible |
varchar(20) |
|
IND |
Y |
|
link_owner |
bigint(20) unsigned |
|
|
1 |
|
link_rating |
int(11) |
|
|
0 |
|
link_updated |
datetime |
|
|
0000-00-00 00:00:00 |
|
link_rel |
varchar(255) |
|
|
|
|
link_notes |
mediumtext |
|
|
|
|
link_rss |
varchar(255) |
|
|
|
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
7 |
link_ID |
link_category |
INDEX |
None |
link_category |
link_visible |
INDEX |
None |
link_visible |
Table: wp_options
Field
Type
Null
Key
Default
Extra
option_id |
bigint(20) unsigned |
|
PRI Pt1 |
NULL |
auto_increment |
blog_id |
int(11) |
|
PRI Pt2 |
0 |
|
option_name |
varchar(64) |
|
PRI Pt3 & IND |
|
|
option_value |
longtext |
|
|
|
|
autoload |
varchar(20) |
|
|
yes |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
184 |
option_id blog_id option_name |
option_name |
UNIQUE |
184 |
option_name |
Table: wp_postmeta
Field
Type
Null
Key
Default
Extra
meta_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
post_id |
bigint(20) unsigned |
|
IND |
0 |
FK->wp_posts.ID |
meta_key |
varchar(255) |
YES |
IND |
NULL |
|
meta_value |
longtext |
YES |
|
NULL |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
13 |
meta_ID |
post_id |
INDEX |
15 |
post_id |
meta_key |
INDEX |
7 |
meta_key |
Table: wp_posts
Field
Type
Null
Key
Default
Extra
ID |
bigint(20) unsigned |
|
PRI & IND Pt4 |
|
auto_increment |
post_author |
bigint(20) unsigned |
|
|
0 |
FK->wp_users.ID |
post_date |
datetime |
|
IND Pt3 |
0000-00-00 00:00:00 |
|
post_date_gmt |
datetime |
|
|
0000-00-00 00:00:00 |
|
post_content |
longtext |
|
|
|
|
post_title |
text |
|
|
|
|
post_excerpt |
text |
|
|
|
|
post_status |
varchar(20) |
|
IND PT2 |
publish |
|
comment_status |
varchar(20) |
|
|
open |
|
ping_status |
varchar(20) |
|
|
open |
|
post_password |
varchar(20) |
|
|
|
|
post_name |
varchar(200) |
|
IND |
|
|
to_ping |
text |
|
|
|
|
pinged |
text |
|
|
|
|
post_modified |
datetime |
|
|
0000-00-00 00:00:00 |
|
post_modified_gmt |
datetime |
|
|
0000-00-00 00:00:00 |
|
post_content_filtered |
text |
|
|
|
|
post_parent |
bigint(20) unsigned |
|
|
0 |
FK->wp_posts.ID |
guid |
varchar(255) |
|
|
|
|
menu_order |
int(11) |
|
|
0 |
|
post_type |
varchar(20) |
|
IND Pt1 |
post |
|
post_mime_type |
varchar(100) |
|
|
|
|
comment_count |
bigint(20) |
|
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
2 |
ID |
post_name |
INDEX |
None |
post_name |
type_status_date |
INDEX |
None |
post_type post_status post_date ID |
post_parent |
INDEX |
None |
post_parent |
post_author |
INDEX |
None |
post_author |
Table: wp_terms
Field
Type
Null
Key
Default
Extra
term_id |
bigint(20) unsigned |
|
PRI |
|
auto_increment |
name |
varchar(200) |
|
|
|
|
slug |
varchar(200) |
|
UNI |
|
|
term_group |
bigint(10) |
|
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
2 |
term_ID |
slug |
UNIQUE |
2 |
slug |
name |
Index |
none |
name |
Table: wp_term_relationships
Field
Type
Null
Key
Default
Extra
object_id |
bigint(20) unsigned |
|
PRI Pt1 |
0 |
|
term_taxonomy_id |
bigint(20) unsigned |
|
PRI Pt2 & IND |
0 |
FK->wp_term_taxonomy.term_taxonomy_id |
term_order |
int(11) |
|
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
8 |
object_id term_taxonomy_id |
term_taxonomy_id |
INDEX |
None |
term_taxonomy_id |
Table: wp_term_taxonomy
Field
Type
Null
Key
Default
Extra
term_taxonomy_id |
bigint(20) unsigned |
|
PRI |
|
auto_increment |
term_id |
bigint(20) unsigned |
|
UNI Pt1 |
0 |
FK->wp_terms.term_id |
taxonomy |
varchar(32) |
|
UNI Pt2 |
|
|
description |
longtext |
|
|
|
|
parent |
bigint(20) unsigned |
|
|
0 |
|
count |
bigint(20) |
|
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
2 |
term_taxonomy_id |
term_id_taxonomy |
UNIQUE |
2 |
term_id taxonomy |
taxonomy |
INDEX |
None |
taxonomy |
Table: wp_usermeta
Field
Type
Null
Key
Default
Extra
umeta_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
user_id |
bigint(20) unsigned |
|
|
'0' |
FK->wp_users.ID |
meta_key |
varchar(255) |
Yes |
IND |
NULL |
|
meta_value |
longtext |
Yes |
IND |
NULL |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
9 |
umeta_id |
user_id |
INDEX |
None |
user_id |
meta_key |
INDEX |
None |
meta_key |
Table: wp_users
Field
Type
Null
Key
Default
Extra
ID |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
user_login |
varchar(60) |
|
IND |
|
|
user_pass |
varchar(64) |
|
|
|
|
user_nicename |
varchar(50) |
|
IND |
|
|
user_email |
varchar(100) |
|
|
|
|
user_url |
varchar(100) |
|
|
|
|
user_registered |
datetime |
|
|
0000-00-00 00:00:00 |
|
user_activation_key |
varchar(60) |
|
|
|
|
user_status |
int(11) |
|
|
0 |
|
display_name |
varchar(250) |
|
|
|
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
1 |
ID |
user_login_key |
INDEX |
None |
user_login |
user_nicename |
INDEX |
None |
user_nicename |
多站点表概述
本部分是Wordpress的Multisite特性所建立的表的概述。这些表通过Administration > Tools > Network下的操作建立。
这些表被看作是全局多站点的表。
WordPress 3.0 Multisite Tables
Table Name
Description
Relevant Area(s) of WordPress User Interface
wp_blogs
Each site created is stored in the table, wp_blogs. |
|
wp_blog_versions
The current database version status of each site is maintained in thewp_blogs_versions table and is updated as each site is upgraded. |
|
wp_registration_log
The wp_registration_log records the admin user created when each new site is created. |
|
wp_signups
This table holds the user that have registered for a site via the login registration process. User registration is enable inAdministration > Super Admin >Options. |
|
wp_site
The wp_site table contains the main site address. |
|
wp_sitecategories
If global terms (global_terms_enabled = true) are enabled for a site thewp_sitecategories table holds those terms. |
|
wp_sitemeta
Each site features information called the site data and it is stored in wp_sitemeta. Variousoption information, including the site admin is kept in this table. |
|
wp_users
The list of all users is maintained in table wp_users. Multisite add two fields not in the stand-alone version. |
|
wp_usermeta
This table is not re-create for multisite, but meta data of usersfor each site are stored inwp_usermeta. |
|
Site Specific Tables
The data of the main site are stored in existing unnumbered tables. The data of additional sites are stored in new numbered tables. |
|
多站点表详细资料
The following describe the tables and fields created during the network installation. Note that a global set of tables is created upon creation of the network, and site-specific tables are established as each site is created.
Table: wp_blogs
Field
Type
Null
Key
Default
Extra
blog_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
site_id |
bigint(20) unsigned |
|
IND |
0 |
|
domain |
varchar(200) |
NO |
|
0 |
|
path |
varchar(100) |
NO |
|
|
|
registered |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
last_updated |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
public |
tinyint(2) |
NO |
|
0 |
|
archived |
enum('0','1') |
NO |
|
0 |
|
mature |
tinyint(2) |
NO |
|
0 |
|
spam |
tinyint(2) |
NO |
|
0 |
|
deleted |
tinyint(2) |
NO |
|
0 |
|
lang_id |
int(11) |
NO |
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
2 |
blog_id |
domain |
INDEX |
none |
domain(50),path(5) |
lang_id |
INDEX |
none |
lang_id |
Table: wp_blog_versions
Field
Type
Null
Key
Default
Extra
blog_id |
bigint(20) unsigned |
|
PRI |
0 |
FK->wp_blogs.blog_id |
db_version |
varchar(20) |
NO |
|
|
|
last_updated |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
2 |
blog_id |
db_version |
INDEX |
none |
db_version |
Table: wp_registration_log
Field
Type
Null
Key
Default
Extra
ID |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
email |
varchar(255) |
NO |
|
|
|
IP |
varchar(30) |
NO |
|
|
|
blog_id |
bigint(20) unsigned |
|
PRI |
0 |
FK->wp_blogs.blog_id |
date_registered |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
1 |
ID |
IP |
INDEX |
none |
IP |
Table: wp_signups
Field
Type
Null
Key
Default
Extra
domain |
varchar(200) |
NO |
|
0 |
|
path |
varchar(100) |
NO |
|
|
|
title |
longtext |
NO |
|
|
|
user_login |
varchar(60) |
NO |
IND |
|
|
user_email |
varchar(100) |
NO |
|
|
|
registered_date |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
activated |
datetime |
NO |
|
0000-00-00 00:00:00 |
|
active |
tinyint(1) |
NO |
|
|
|
activation_key |
varchar(50) |
NO |
|
|
|
meta |
longtext |
|
|
|
|
Indexes
Keyname
Type
Cardinality
Field
activation_key |
INDEX |
None |
activation_key |
domain |
INDEX |
None |
domain |
Table: wp_site
Field
Type
Null
Key
Default
Extra
id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
domain |
varchar(200) |
NO |
|
0 |
|
path |
varchar(100) |
NO |
|
|
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
1 |
id |
domain |
INDEX |
none |
domain,path |
Table: wp_sitecategories
Field
Type
Null
Key
Default
Extra
cat_id |
bigint(20) unsigned |
NO |
PRI |
NULL |
auto_increment |
cat_name |
carchar(55) |
NO |
|
|
|
category_nicename |
varchar(200) |
NO |
|
|
|
last_updated |
timestamp |
NO |
|
|
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
9 |
cat_id |
category_nicename |
INDEX |
None |
category_nicename |
last_updated |
INDEX |
None |
last_updated |
Table: wp_sitemeta
Field
Type
Null
Key
Default
Extra
meta_id |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
site_id |
bigint(20) unsigned |
|
|
'0' |
FK->wp_site.site_id |
meta_key |
varchar(255) |
Yes |
IND |
NULL |
|
meta_value |
longtext |
Yes |
IND |
NULL |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
9 |
meta_id |
meta_key |
INDEX |
None |
meta_key |
site_id |
INDEX |
None |
site_id |
Table: wp_users
Field
Type
Null
Key
Default
Extra
ID |
bigint(20) unsigned |
|
PRI |
NULL |
auto_increment |
user_login |
varchar(60) |
|
IND |
|
|
user_pass |
varchar(64) |
|
|
|
|
user_nicename |
varchar(50) |
|
IND |
|
|
user_email |
varchar(100) |
|
|
|
|
user_url |
varchar(100) |
|
|
|
|
user_registered |
datetime |
|
|
0000-00-00 00:00:00 |
|
user_activation_key |
varchar(60) |
|
|
|
|
user_status |
int(11) |
|
|
0 |
|
display_name |
varchar(250) |
|
|
|
|
spam |
tinyint(2) |
NO |
|
0 |
|
deleted |
tinyint(2) |
NO |
|
0 |
|
Indexes
Keyname
Type
Cardinality
Field
PRIMARY |
PRIMARY |
1 |
ID |
user_login_key |
INDEX |
None |
user_login |
user_nicename |
INDEX |
None |
user_nicename |
Site Specific Tables
When a new additional site is created, the site-specific tables, similar to the stand-alone tables above, are created. Each set of tables for a site are created with the site ID (blog_id
) as part of the table name. These are the tables that would be created for site ID 2 and table_prefix wp:
The data of the main site are stored in unnumbered tables.
资源
更新日志
http://codex.wordpress.org/zh-cn:%E6%95%B0%E6%8D%AE%E5%BA%93%E6%8F%8F%E8%BF%B0#Table:_wp_comments
- 大小: 143.5 KB
分享到:
相关推荐
- `<meta name="description" content="...">` 描述标签告诉搜索引擎页面的大致内容。 - `<meta name="keywords" content="...">` 关键词标签列出页面的关键字。 - **内容优化:** - 创建高质量、有价值的内容。...
Wordpress 是一个流行的开源内容管理系统,其数据库结构是其高效运行的基础。在分析Wordpress的数据库结构时,我们可以看到它主要由10个表格组成,这些表格之间通过外键关联,形成一个完整的数据模型,支持博客系统...
- `<meta name="description" content="...">`: 描述标签,用于描述页面的主要内容。 - `<meta name="keywords" content="...">`: 关键词标签,列出页面的关键字。 - **标题标签**: `<title>`标签用于定义网页的...
本文将详细解析WordPress数据库中的主要表及其字段,帮助你更好地掌握WordPress的数据管理。 首先,我们来看`wp_categories`表,这是存储网站分类信息的地方。它包含了5个字段: 1. `cat_ID`:每个分类的唯一...
HTML5是现代网页设计的标准,它引入了许多新特性,如语义化标签(例如<header>、<footer>、<article>),离线存储,媒体元素(如<audio>和<video>),以及Canvas和SVG等图形绘制工具。在HTML5中创建PPT,可能是通过...
2. **媒体支持**:内置的<video>和<audio>标签使得在网页中内嵌视频和音频变得更加简单,无需依赖Flash等第三方插件。 3. **离线存储**:通过离线存储(Application Cache)特性,HTML5可以缓存关键资源,使得用户在...
- **元信息**:利用HTML5的<meta>标签添加合适的元信息,如关键词、描述,提升搜索引擎排名。 - **页面速度**:优化图片大小和格式,减少HTTP请求,提升页面加载速度。 5. 后端技术结合: - **CMS系统**:可能...
2. **替换WordPress数据库连接文件**: 将WordPress的`wp-config.php`中的数据库连接设置改为使用SQLite。通常,这涉及到更改`DB_NAME`,`DB_USER`,`DB_PASSWORD`和`DB_HOST`变量。可以参考提供的`db.php`和`sqlite....
它通过一系列标签来定义网页元素,如标题(`<h1>`到`<h6>`)、段落(`<p>`)、图像(`<img>`)、链接(`<a>`)等。HTML文件通常以`.html`或`.htm`为扩展名,它们是静态网页的基本组成部分,直接告诉浏览器如何展示...
### WordPress数据库探究:深入理解核心数据结构 #### 引言 WordPress作为全球最受欢迎的内容管理系统之一,其强大功能的背后,离不开数据库的支持与优化。本文旨在深入探究WordPress数据库的组织架构、数据表及其...
WordPress 数据库表结构关系图(E-R 图)展示了 WordPress 数据库中的表结构和关系,该图表描述了 WordPress 数据库中的每个表的结构和关系,使开发者更好地理解 WordPress 数据库的结构和关系。 通过了解 ...
>">阅读更多</a>` 8. **`the_content()`** - **用途**: 输出文章的内容。 - **示例**: `<?php the_content(); ?>` 9. **`the_author()`** - **用途**: 输出文章作者的名字。 - **示例**: `<span>作者:<?...
【描述】: 描述中的 "基于PHP的WordPress插件HTML5悬浮播放器php版源码.zip" 指的是这个插件的源代码文件已经打包成ZIP格式供下载。源码对于开发者来说非常重要,因为它提供了完全透明的实现细节,使得用户可以...
常见的元素有标题(<h1>-<h6>)、段落(<p>)、引用(<blockquote>)、列表(<ul>, <ol>, <li>)、链接(<a>)以及图片(<img>)等。HTML5引入的新元素,如<header>、<nav>、<article>、<section>和<footer>等,使得...
在深入探讨WordPress 3.0的数据库结构之前,我们需要理解WordPress作为一个开源内容管理系统(CMS)的核心功能。WordPress主要用于创建博客和网站,而其背后的数据库存储了所有内容、用户信息、评论、链接以及其他关键...
8. **后台集成**:虽然描述中没有明确指出,但通常这样的模板会设计成可以与后端数据库和内容管理系统(如WordPress、Drupal或Joomla)无缝集成,方便添加、编辑和管理网站内容。 9. **文件组织**:压缩包内的...
1. HTML5的结构元素:如`<article>`、`<section>`、`<footer>`等,用于组织评论内容。 2. CSS3的布局技术:如Flexbox或Grid,用于排列评论和头像。 3. JavaScript基础:用于监听滚动事件,计算元素位置,以及更新...
在博客源代码中,`<title>`标签用于定义浏览器标题栏显示的页面标题,而`<meta>`标签提供关于文档的元信息,如字符编码、描述和关键词,这对搜索引擎优化(SEO)至关重要。`<header>`和`<footer>`标签分别用于定义...
管理屏幕,数据库,编辑器至少需要:3.0.0经过测试:4.2.2稳定的标签:中继许可证:BSD URL: : 描述这是一个Wordpress插件,可以直接对Excelpress数据库中的表格进行类似excel的编辑。 它的目标是提供有用,简单,...