WordPress table structure

Source: Internet
Author: User
Tags autoload ping link types of functions wordpress database
Document directory
  • Iii. WordPress tables are classified by function

URL: http://www.girlcoding.com/2011/08/wordpress-database-design/

WordPress has the following 11 tables. The default table prefix WP _ is added here _.

  • Wp_commentmeta: stores the metadata of comments.
  • Wp_comments: store comments
  • Wp_links: storage links (girl is coding)
  • Wp_options: stores WordPress System Options, plug-ins, and topic configurations.
  • Wp_postmeta: stores the metadata of an article (including pages, uploaded files, and revisions ).
  • Wp_posts: stores articles (including pages, uploaded files, and revisions)
  • Wp_terms: stores each directory, tag, and category.
  • Wp_term_relationships: stores the relationship between each article, link, and corresponding category.
  • Wp_term_taxonomy: stores the categories corresponding to each directory and tag.
  • Wp_usermeta: stores user metadata.
  • Wp_users: storage user
  • In the WordPress database structure, the wp_options table in the storage system options and plug-in configuration is relatively independent. As mentioned later, it adopts the key-value mode for storage, the advantage of doing so is that it is easy to expand, and various plug-ins can easily store their own configurations here.

    Post, comment, and user are the combination of three basic tables and extended tables. Taking wp_users as an example, wp_users has stored the basic information that each user will use, such as common information such as login_name, display_name, password, and email. However, if we want to store some infrequently used data, the best practice is not to add a column after the table to destroy the default table structure, but to store data in wp_usermeta. The wp_usermeta extension table has a similar structure as the wp_options table. We can store QQ numbers, mobile phone numbers, and theme options for logging on to the WordPress background for each user.

    It is hard to understand the term, that is, wp_terms, wp_term_relationships, and wp_term_taxonomy. In WordPress systems, we often classify articles, links, and tags. It is also a special classification method, we can even create our own classification methods. WordPress records all categories, classification methods, and corresponding structures in these three tables. Wp_terms records the names and basic information of each category. For example, this site is divided into "WordPress development" and "WPCEO plug-in". The category here refers to the classification in a broad sense, therefore, each TAG is also a "classification ". Wp_term_taxonomy records the classification methods of each category. For example, "WordPress development" and "WPCEO plug-in" are document categories ), the "my friends" and "my colleagues" categories that place links belong to the link category (link_category ). Wp_term_relationships records the classification method corresponding to each article (or link.

    Fortunately, regarding the use of term, the use of related functions in WordPress is clear and clear, so we don't have to worry about its construction.

    Wp_commentmeta

    • Meta_id: Unique auto-increment ID
    • Comment_id: Comment ID
    • Meta_key: key name
    • Meta_value: Key Value

    Wp_comments

    • Comment_id: auto-increment unique ID
    • Comment_post_id: Document ID
    • Comment_author: reviewer
    • Comment_author_email: reviewer's email
    • Comment_author_url: reviewer URL
    • Comment_author_ip: comment_author_ip
    • Comment_date: Comment time
    • Comment_date_gmt: Comment time (GMT + 0 time)
    • Comment_content: Comment body
    • Comment_karma: Unknown
    • Comment_approved: whether the comment is approved
    • Comment_agent: reviewer's user agent
    • Comment_type: Comment type (pingback/normal)
    • Comment_parent: parent comment ID
    • User_id: reviewer user ID (not necessarily exists)

    Wp_links

    • Link_id: auto-increment unique ID
    • Link_url: link URL
    • Link_name: link title
    • Link_image: link Image
    • Link_target: Link Opening Method
    • Link_description: Link Description
    • Link_visible: visible (y/N)
    • Link_owner: the user ID of the adder.
    • Link_rating: Rating
    • Link_updated: Unknown
    • Link_rel: xfn relationship
    • Link_notes: xfn Annotation
    • Link_rss: link RSS address

    Wp_options

    • Option_id: auto-increment unique ID
    • Blog_id: blog ID, used for multi-user blogs. The default value is 0.
    • Option_name: key name
    • Option_value: Key Value
    • Autoload: automatically loaded during WordPress loading (Yes/No)

    Wp_postmeta

    • Meta_id: Unique auto-increment ID
    • Post_id: Document ID
    • Meta_key: key name
    • Meta_value: Key Value

    Wp_posts

    • ID: auto-increment unique ID
    • Post_author: Corresponding author ID
    • Post_date: release time
    • Post_date_gmt: release time (GMT + 0)
    • Post_content: Body
    • Post_title: Title
    • Post_excerpt: Abstract
    • Post_status: Article status (publish/auto-draft/inherit)
    • Comment_status: Comment status (open/closed)
    • Ping_status: PING status (open/closed)
    • Post_password: password of the document
    • Post_name: name of the article
    • To_ping: Unknown
    • Pinged: The PING link.
    • Post_modified: modification time
    • Post_modified_gmt: modification time (GMT + 0 time)
    • Post_content_filtered: Unknown
    • Post_parent: parent document, mainly used for PAGE
    • Guid: Unknown
    • Menu_order: Sorting ID
    • Post_type: Document Type (post/page, etc)
    • Post_mime_type: MIME type
    • Comment_count: Total number of comments

    Wp_terms

    • Term_id: Category ID
    • Name: category name
    • Slug: Scaling name
    • Term_group: Unknown

    Wp_term_relationships

    • Object_id: Document ID/link ID
    • Term_taxonomy_id: ID of the corresponding classification method
    • Term_order: Sorting

    Wp_term_taxonomy

    • Term_taxonomy_id: Category method ID
    • Term_id:
    • Taxonomy: Classification Method (category/post_tag)
    • Description: Unknown
    • Parent: parent category method ID
    • Count: Number of articles

    Wp_usermeta

    • Umeta_id: Unique ID of auto-Increment
    • User_id: corresponding user ID
    • Meta_key: key name
    • Meta_value: Key Value

    Wp_users

    • ID: auto-increment unique ID
    • User_login: Login Name
    • User_pass: Password
    • User_nicename: nickname
    • User_email: Email
    • User_url: URL
    • User_registered: Registration Time
    • User_activation_key: activation code
    • User_status: User status
    • Display_name: Display name
    Iii. WordPress tables are classified by function

    There are roughly five types of functions:

    ① User information: wp_users and wp_usermeta

    ② Link information: wp_links

    ③ Articles and comments: wp_posts, wp_postmeta, wp_comments, wp_commentmeta

    ④ Classification, link classification, tag management: wp_term, wp_term_relationships, wp_term_taxonomy

    ⑤ Global settings: wp_options

    (1) wp_posts

    This wp_posts table is the place where the blog posts "articles" are stored. In addition to common articles, this table also contains information about attachments and pages. The post_type field is used to differentiate document types. If post_type is 'post', It is an article. If it is 'page', It is a page. If it is 'attachment ', it is an attachment.

    (2) wp_postmeta

    This table is very simple. Only meta_id, post_id, meta_key, and meta_value fields are supported. Post_id is the ID of the related "article. Meta_value is of the longtext type. It is only used to store values. When writing an article, there is a custom fields option under the edit box. We can add post meta information here.

    (3) wp_comments

    The two most important fields are comment_post_id and comment_approved. The first one is used to indicate which article the comment belongs to and the other one is used to record the review status. Another interesting thing is the commnet_agent field. You can use this field to calculate the type of your browser.

    (4) wp_commentmeta

    WordPress 2.9 now supports commentmeta ). Currently, we are not sure how this function is used.

    (5) wp_users

    User Account table. The storage username and password also contain some basic user information.

    (6) wp_usermeta

    Similar to the preceding wp_postmeta, it stores some other user information.

    (7) wp_options

    Used to record some WordPress settings and options. There is a blog_id field, which should be used in the Mu version to mark different blogs. The autoload field is used to control whether the options are always imported and cached by WordPress or plug-ins, or whether the options are imported only when required.

    (8) wp_links

    Used to store links in blogroll.

    (9) wp_terms

    It stores the basic information of a term. Name is the name of the term, and slug is used to make the URL friendly. Term_group is used to aggregate similar terms. Term_id is the unique ID of a term.

    (10) wp_term_taxonomy

    CATEGORY information supplements the relationship information of wp_terms information, including the category, link_category, tag, and detailed description of the number of articles (LINKS) owned by wp_terms.

    (11) wp_term_relationships

    Combine posts and links objectsTerm_taxonomyIn a relational table associated with term_taxonomy_id, object_id is associated with different objects, for example, ID in wp_posts (link_id in wp_links). term_taxonomy_id is associated with term_taxonomy_id in wp_term_taxonomy.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.