WordPress Content Tables

Get and retrieve all content of your website, then access the wp_posts table for retrieve all content. All your posts, pages, revisions and attachments are stores in this table. The records of attachment are stored in this table, remember that the actual attachments are not. Attachments are physically stored on your hosting server as a standard file. Below is a SQL query is an example that how to extract all of your posts from the database table, and what happens in the default WordPress Loop:

SELECT * FROM wp_posts WHERE post_type = ‘post’ AND post_status = ‘publish’ ORDER BY post_date DESC

Above query selects all records from the table of wp_posts and with the psot type of ‘post’. So the post_type field Is use for designates that what type of content you are viewing. If you want to get the pages then just change that value to ‘page’. In above query get those post which has published, as you can see the sure post_status is set to ‘publish’. Also get the post record by post_date descending, now your posts will be displayed in reverse chronological order.

Now discusse about some of the more useful fields which in the wp_posts table. In the wp_posts ID field contains your post’s unique ID you already know it.

In this table the post_author field is the unique ID which is use for the auther posts that by which auhter is posted. So by this field you can retrieve author-specific data from the wp_users table. In the post_date is the date the post was created. All the main content of your post or page are store in the the post_content field and post_title is the title of that content it may be post or page. Another important field in this table is the post_status field. This saves the information that currently status of pist of page and there are seven different status in WordPress that are defined below:

1. publish —Publish Post of page.

2. inherit — A post revision.

3. pending — Post that is pending review by an administrator or editor.

4. private — A private post.

5. future — A post scheduled to publish at a future date and time.

6. draft — A post still being created and is a draft.

7. trash — Content is in the trash bin and can still be recovered.

In this table the post_type is also stored in this table.The purpose of this field is distinguishes the different types of contentin WordPress: it may be page, posts, attachments and revisions.

The release of Wordroress 2.0, the custom post types can be created or genrated, which opens the door to endless possibilities when defining custom content in WordPress.

User account information stores in the wp_users table it contains data for your registered member. Once again, the ID you can see in this table it indicating the unique identifier for user records. The username of user store in the user_login field. User must enter this value when user logging in to WordPress.User password store in the user_pass field. Registered user’s e-mail is stored in the user_email field.

The member’s website address stored in the user_url field and the user registration date is saved in user_registered field. Now explore about the wp_comments table. All of the comments stores in this table, pingbacks, and trackbacks for your website. Comment records view, comment_ID is the stores every specific id for every comment.

It is still the unique identifier for this record in the table. Which comment is store for which post then the comment_post_ID is the unique ID of the post the comment. In WordPress by default you don’t have to be logged in to make comments. That’s the reason, you’ll see similar fields as in your users table.

Who give the comment the of commenter stores in the comment_author field. The email address conatain of commenter in the comment_author_email field, the commenter url store in the comment_author_url field. comment_date is another important field, it stores the date when comment was created. Display your post comments in the correct order.