what is a content management system (cms)? …content management system can be a headache. a cms is...

30
BCA SEM III WORDPRESS Unit-2 Vasavda Rohit H What is a Content Management System (CMS)? A Content Management System ( CMS ) is used to add, edit, and delete content on a website. For a small website, such as this, adding and deleting a page manually is fairly simple. But for a large website with lots of pages like a news website adding a page manually without a content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The pages content are stored in database, not in the file server. Introduction of Wordpress WordPress is an online, open source website creation tool written in PHP. Another reason WordPress is popular is because it is provided to users at no charge. Anyone who uses WordPress to power their website does not need to pay the software publisher any licensing fees. WordPress was used by more than 27.5% of the top 10 million websites as of February 2017 WordPress is reportedly the most popular website management or blogging system in use on the Web, supporting more than 60 million websites WordPress was released on May 27, 2003, by its founders, Matt Mullenweg and Mike Little, as a fork of b2/cafelog. WordPress is released under the GPLv2 (or later) license Developer(s) WordPress Foundation Initial release May 27, 2003; 14 years ago Stable release 4.8 (June 8, 2017; 10 days ago) Preview release 4.7 RC (November 24, 2016; 6 months ago) Repository core.trac.wordpress.org/browser Written in PHP Operating system Unix-like, Windows Type Blog software, Content Management System, Content Management Framework

Upload: others

Post on 17-Aug-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

What is a Content Management System (CMS)? A Content Management System ( CMS ) is used to add, edit, and delete content on a website. For a small website, such as this, adding and deleting a page manually is fairly simple. But for a large website with lots of pages like a news website adding a page manually without a content management system can be a headache.

A CMS is meant to ease the process of adding and modifying new content to a webpage. The pages content are stored in database, not in the file server.

Introduction of Wordpress WordPress is an online, open source website creation tool written in PHP. Another reason WordPress is popular is because it is provided to users at no charge. Anyone who uses WordPress to power their website does not need to pay the software publisher any licensing fees.

• WordPress was used by more than 27.5% of the top 10 million websites as of February 2017

• WordPress is reportedly the most popular website management or blogging system in use on the Web, supporting more than 60 million websites

• WordPress was released on May 27, 2003, by its founders, Matt Mullenweg and Mike Little, as a fork of b2/cafelog. WordPress is released under the GPLv2 (or later) license

Developer(s) WordPress Foundation

Initial release May 27, 2003; 14 years ago

Stable release 4.8 (June 8, 2017; 10 days ago)

Preview release 4.7 RC (November 24, 2016; 6 months ago)

Repository core.trac.wordpress.org/browser

Written in PHP

Operating system Unix-like, Windows

Type Blog software, Content Management System, Content Management Framework

Page 2: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

License GNU GPLv2

Website wordpress.org

Features of Wordpress

User Management: It allows managing the user information such as changing the role of the users to (subscriber, contributor, author, editor or administrator), create or delete the user, change the password and user information. The main role of the user manager is Authentication.

Media Management: It is the tool for managing the media files and folder, in which you can easily upload, organize and manage the media files on your website.

Theme System: It allows modifying the site view and functionality. It includes images, stylesheet, template files and custom pages.

Extend with Plugins: Several plugins are available which provides custom functions and features according to the users need.

Search Engine Optimization: It provides several search engine optimization (SEO) tools which makes on-site SEO simple.

Multilingual: It allows translating the entire content into the language preferred by the user.

Importers: It allows importing data in the form of posts. It imports custom files, comments, post pages and tags.

Advantages It is an open source platform and available for free. CSS files can be modified according to the design as per users need. There are many plugins and templates available for free. Users can customize the various

plugins as per their need. It is very easy to edit the content as it uses WYSIWYG editor (What You See Is What You Get is a

user interface that allows the user to directly manipulate the layout of document without having a layout command).

Media files can be uploaded easily and quickly. It offers several SEO tools which makes on-site SEO simple. Customization is easy according to the user's needs. It allows creating different roles for users for website such as admin, author, editor and

contributor.

Disadvantages

Page 3: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Using several plugins can make the website heavy to load and run. PHP knowledge is required to make modifications or changes in the WordPress website. Sometimes software needs to be updated to keep the WordPress up-to-date with the current

browsers and mobile devices. Updating WordPress version leads to loss of data, so it a backup copy of the website is required.

Modifying and formatting the graphic images and tables is difficult.

• WAMP (Windows)

Installation of Wordpress System Requirements for WordPress Database: MySQL 5.0+ Web Server:

• LAMP (Linux) • XAMP (Multi-platform) • MAMP (Macintosh)

Operating System: Cross-platform Browser Support: IE (Internet Explorer 8+), Firefox, Google chrome, Safari, Opera PHP Compatibility: PHP 5.2+ Download WordPress When you open the link https://wordpress.org/download/, you will get to see a screen as the following snapshot:

Download the WordPress zip file from the official site. Create Store Database WordPress requires MySQL database. So create a new empty database with user/password (for example, user as "root" and password as "root" or else you can set as per your convenience).

Then, you can continue with the installation process as discussed further.

Page 4: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Set Up Wizard It's very easy to set up WordPress into your system. The following steps describe how to set up WordPress locally on your system. Step (1): Extract the downloaded WordPress folder and upload it into your web server or localhost.

Step (2): Open your browser and navigate to your WordPress file path, then you will get the first screen of the WordPress installer as shown in the following screen. In our case, the path is localhost/< Your_WordPress_folder >.

Select your language for the WordPress and click on Continue. Step (3): In this step, you can view the information needed for the database before proceeding with WordPress installation.

Page 5: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Click on Let's go! Step (4): Here, you have to enter the information about the MySQL database as described in the following screen.

Page 6: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

• Database Name: Enter the database name which you have created in MySQL database for WordPress.

Username: Enter the user name of your MySQL database.

Password: Enter the password which you had set for MySQL database.

Database Host: Write the host name, by default it will be localhost.

Table Prefix: It is used to add prefix in the database tables which helps to run multiple sites on the same database. It takes the default value. After filling all information, click on Submit button. Step (5): WordPress checks the database setting and gives you the confirmation screen as shown in the following snapshot.

Page 7: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Click on Run the install Step (6): Enter administrative information.

It contains the following fields: Site Title: Enter the name of the site which you are going to create in WordPress.

Username: Enter the username as per your choice while logging in the WordPress.

Password twice: Enter password two times to protect your site.

Your E-mail: Enter your e-mail address which helps to recover the password or any update.

Privacy: It allows the search engine to index this site after checking the checkbox. After filling all the information, click on the Install WordPress button.

Step (7): After installation being successful, you will get a screen of the stating success as seen in the following screen.

Page 8: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

You can view your username and password detail added in WordPress. Click on Log In button.

Step (8): After clicking on login, you will get a WordPress Admin Panel as depicted in the following screen.

Page 9: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Enter the username and password which you had mentioned during installation as shown in step 6 and click on the Log In button.

Page 10: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Wordpress Directory & file structure Do you want to learn about WordPress file and directory structure? The core WordPress

software, themes, plugins, and user uploads are all stored on your website. In this

beginner’s guide, we will explain the WordPress file and directory structure.

Why You Should Learn About WordPress File and Directory Structure?

Most users can run their WordPress site without ever learning about WordPress files or

directories. However, understanding how WordPress stores files and directories can

help you solve many common WordPress problems on your own.

This guide will help you: Learn which WordPress files and folders are core files.

Understand how WordPress stores your images and media uploads.

Where WordPress stores your themes and plugins.

Where configuration files are stored on your WordPress install.

This information also helps you learn which WordPress files should you backup.

Page 11: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

You will also be able to perform troubleshooting tasks like deactivating all WordPress

plugins, switching to a default theme, or fix other common WordPress errors.

Having said that, let’s take a look at WordPress file and directory structure. Accessing WordPress Files and Directories

First, you will need a FTP client to connect to your WordPress server. See our guide

on how to use FTP to upload WordPress files for detailed instructions.

An easier alternative to FTP is File Manager. It is a web based application that comes

built into cPanel dashboard of your WordPress hosting account.

Once you have connected to your WordPress site either using FTP or File Manager,

you will see a file and directory structure that looks like this:

Files and folders in the red squares are the core WordPress files. These are the files

and folders that run your WordPress site. You are not supposed to edit those files on

your own.

Here is a list of core WordPress files and folders you would see in your WordPress

site’s root directory. [dir] wp-admin

[dir] wp-includes

index.php

Page 12: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

license.txt

readme.html

wp-activate.php

wp-blog-header.php

wp-comments-post.php

wp-config-sample.php

wp-cron.php

wp-links-opml.php

wp-load.php

wp-login.php

wp-mail.php

wp-settings.php

wp-signup.php

wp-trackback.php

xmlrpc.php

WordPress Configuration Files

Your WordPress root directory contains some special configuration files. These files

contain important settings specific to your WordPress site.

Page 13: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

.htaccess – A server configuration file, WordPress uses it to

manage permalinks and redirects.

wp-config.php – This file tells WordPress how to connect to your database. It also sets some global settings for your WordPress site.

index.php – The index file basically loads and initializes all your WordPress files when a page is requested by a user.

You may need to edit wp-config.php or .htaccess file sometimes. Be extra careful when

editing these two files. A slight mistake can make your site inaccessible. When editing

these two files, always create backup copies on your computer before making any

changes.

If you don’t see .htaccess file in your root directory, then checkout our guide on why

you can’t find .htaccess file in your WordPress root directory.

Depending on how your WordPress site is setup, you may or may not have the following

files in your root directory. robots.txt – Contains instructions for search engines crawlers

Favicon.ico – A favicon file is sometimes generated by WordPress hosts.

Page 14: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Inside wp-content Folder

WordPress stores all uploads, plugins, and themes in wp-content folder.

It is generally assumed that you can edit files and folders inside wp-content folder.

However, this is not entirely true.

Let’s take a look inside wp-content folder to understand how it works and what you can

do here.

The contents of wp-content folder may differ from one WordPress site to another. But all

WordPress sites usually have these: [dir] themes

[dir] plugins

[dir] uploads

index.php

Page 15: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

WordPress stores your theme files in /wp-content/themes/ folder. You can edit a theme

file, but it is generally not recommended. As soon as you update your theme to a newer

version, your changes will be overwritten during the update.

This is why it is recommended to create a child theme for WordPress theme

customization.

All WordPress plugins you download and install on your site are stored in /wp-

content/plugins/ folder. You are not supposed to edit plugin files directly, unless you

wrote the plugin just for your own WordPress site.

In many WordPress tutorials, you will see code snippets that you can add to your

WordPress site. The best way to add custom code to your WordPress site is by adding

it to functions.php file of your child theme or by creating a site-specific plugin.

WordPress stores all your image and media uploads in the /wp-

content/uploads/ folder. By default, uploads are organized in/year/month/ folders.

Whenever you are creating a WordPress backup, you should include uploads folder.

You can download fresh copies of WordPress core, your theme, and installed plugins

from their sources. But if you lose your uploads folder, then it would be very hard to

restore it without a backup.

Some other default folders you may see in your wp-content directory. languages – WordPress stores language files for non-english WordPress sites in this

folder.

upgrade – This is a temporary folder created by WordPress during upgrade to a newer version

Many WordPress plugins may also create their own folders inside your wp-content

folder. For example, in the screenshot above we have a gallery folder created by Envira

Gallery plugin.

Some of these folders may contain important files. Like the gallery folder may contain

your gallery images. You should always backup such folders to avoid losing important

data.

Page 16: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Other folders may contain files that you can safely delete. For example your caching

plugins like W3 Total Cache or WP Super Cache may store cached files in their own

folders.

That’s all, we hope this article helped you understand WordPress file and directory

structure. You may also want to see our beginner’s guide to WordPress database

management with phpMyAdmin.

Page 17: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Attech to post or page

In WordPress you can upload, store, and display a variety of file types (media). The most common file types are image, video and audio files, but other file types such as document files, spreadsheet files, and code samples (amongst others) can also be managed within WordPress.

User Roles and Capabilities.

Page 18: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Settings → Permalinks Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change — hence the name permalink. The Settings Permalinks Screen allows you to choose your default permalink structure. You can choose from common settings or create custom URL structures. You must click the Save Changes button at the bottom of the screen for new settings to take effect.

By default, WordPress uses web URLs which have day and name in them; however, WordPress offers you the ability to create a custom URL structure for your permalinks and archives. This can improve the aesthetics, usability, and forward-compatibility of your links.

For a more in depth description of the way this structure is specified, see the Using Permalinks article. For an introduction to Permalinks, read the Pretty Permalinks section of Introduction to Blogging.

Back to Administration Screens.

Page 19: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Customize Permalink Structure A number of tags are available, and here are some examples to get you started.

Common settings

Check one of the radio buttons corresponding to the correct Permalink Structure for your blog.

Default - An example of the default structure is http://www.sample.com/?p=123 Day and name - An example of the day and name based structure

is http://www.sample.com/2008/03/31/sample-post/ Month and name - An example of the month and name based structure

is http://www.sample.com/2008/03/sample-post/ Numeric - An example of the numeric structure is http://www.sample.com/archives/123 Post name - An example of the post name structure is http://www.sample.com/sample-post Custom structure - In the box specify the custom structure you desire to use. One example

is /archives/%year%/%monthnum%/%day%/%postname%/. Look at the Using Permalinks article for further discussion of Permalink Structure Tags.

Updating wordpress

One-Click Update

Major core updates are changes to the main WordPress software where the version rolls over from multiple numbers to just two such as 4.4 and 4.5, for example. When these major updates are made available to everyone, you should see a message letting you know and you can update your site with one click in your admin or super admin dashboard.

Click the Please update now link or the update button in the admin bar at the top of the page. Keep in mind that during the updating process, your site is placed into maintenance mode which means that your site becomes temporarily unavailable and a message is displayed to let your visitors know. Once the update is complete, your visitors can access your full site again.

Page 20: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

When updates become available, a message appears in the dashboard.

After clicking the update button or link in the dashboard, you’re directed to the updates page where it’s suggested you create a full backup of your site as was covered earlier. If you have your backup ready, you can go ahead and update your site by clicking the Update Now button.

Once you have made a recent backup, you can update your site.

For single installations, the update should be completed in a few minutes or less and you should be redirected to your admin dashboard with information displayed about the latest version. If you are the super admin of a Multisite network, there’s one additional step before your update is complete.

Page 21: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Once you have clicked the Update Now button and you’re redirected, click the Upgrade Network button that’s displayed in the message at the top of the page.

For Multisite installs, you can update your network with one click.

At this point in the process, your main site has been updated, but all the sites in your network have not switched over to the latest version. On the Upgrade Network page, you can push your entire network to get up to date with one click. This doesn’t just prompt all your network’s sites to update. Instead, the update is applied to all sites right away.

You can upgrade your network with one click.

Page 22: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Click the Upgrade Network button to instantly update your entire network. This process is quick but can take several minutes for larger networks. If your browser doesn’t automatically redirect you to the next page, you can click the Next Sites button that appears when the upgrade is complete. When the upgrade has successfully completed, you should see a page with the message “All done!” Once you see it, you have finished and your network is now at the latest version.

If you have installed WordPress in a different language, the update process is the same, except the WordPress Updates page looks slightly different.

You can upgrade with the language you previously installed or you can choose the default language update.

You have the option to click two different Update Now buttons. The first one that appears, when clicked, updates your site in the language you already have installed. If you choose the second Update Now button, your site or network upgrades to the default and newest version of WordPress in US English. If you want to keep your site in the language it’s in currently, click the first Update Now button in blue and complete the rest of the process as you normally would. Sometimes, an update goes wrong and doesn’t complete which results in your site being stuck in maintenance mode. If this happens to you, there’s a quick

Page 23: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Manual WordPress Update First step:

1. Download the latest version of WordPress here http://wordpress.org/download/

2. Unzip the files 3. Delete your existing old wp-includes and wp-admin directories on your

server (Using FTP or File Manager). 4. Upload the new wp-includes and wp-admin folders (directories) to your

server.(using FTP or Shell Access SSH) 5. Open the wp-content folder and upload the individual files from the new

folder to your existing wp-content folder (Using FTP, File Manager or Shell SSH), overwriting existing files. Do NOT delete your existing wp-content folder. Do NOT delete any files or folders in your existing wp-content directory (except for the one being overwritten by new files).

6. Upload all remaining new individual files from the root directory (folder) of the new version to your existing wordpress root directory.

The Tables

Database Structurs

• wp_posts • wp_postmeta • wp_comments • wp_commentmeta • wp_terms • wp_term_taxonomy • wp_term_relationships • wp_users • wp_usermeta • wp_options • wp_links

wp_posts

The posts table is arguably the most important table in the database. Its name sometimes throws people who believe it purely contains their blog posts. However, albeit badly named, it is an extremely powerful table that stores various types of content including posts, pages, menu items, media attachments and any custom post types that a site uses.

Page 24: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

The table’s flexible content nature is provided by the ‘post_type’ column which denotes if the row is a post, page, attachment, nav_menu_item or another type. But this flexibility also makes it hard to discuss and describe. Essentially the table contains rows of content objects with different types, but for ease of reading, I will refer to the rows as “posts” throughout this article.

• ID – unique number assigned to each post. • post_author – the user ID who created it. (Reference to the wp_users table.) • post_date – time and date of creation. • post_date_gmt – GMT time and date of creation. The GMT time and date is stored so

there is no dependency on a site’s timezone in the future. • post_content – holds all the content for the post, including HTML, shortcodes and other

content. • post_title – title of the post. • post_excerpt – custom intro or short version of the content. • post_status – status of the post, e.g. ‘draft’, ‘pending’, ‘private’, ‘publish’. Also a great

WordPress news site. • comment_status – if comments are allowed. • ping_status – if the post allows ping and trackbacks. • post_password – optional password used to view the post. • post_name – URL friendly slug of the post title. • to_ping – a list of URLs WordPress should send pingbacks to when updated. • pinged – a list of URLs WordPress has sent pingbacks to when updated. • post_modified – time and date of last modification. • post_modified_gmt – GMT time and date of last modification. • post_content_filtered – used by plugins to cache a version of post_content typically

passed through the ‘the_content’ filter. Not used by WordPress core itself. • post_parent – used to create a relationship between this post and another when this

post is a revision, attachment or another type. • guid – Global Unique Identifier, the permanent URL to the post, not the permalink

version. • menu_order – holds the display number for pages and other non-post types. • post_type – the content type identifier. • post_mime_type – only used for attachments, the MIME type of the uploaded file. • comment_count – total number of comments, pingbacks and trackbacks.

wp_postmeta

This table holds any extra information about individual posts. It is a vertical table using key/value pairs to store its data, a technique WordPress employs on a number of tables throughout the database allowing WordPress core, plugins and themes to store unlimited data.

• meta_id – unique number assigned to each row of the table. • post_id – the ID of the post the data relates to. (Reference to the wp_posts table.) • meta_key – an identifying key for the piece of data. • meta_value – the actual piece of data.

Page 25: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

wp_comments

Any post that allows discussion can have comments posted to it. This table stores those comments and some specific data about them. Further information can be stored in wp_commentmeta.

• comment_ID – unique number assigned to each comment. • comment_post_ID – ID of the post this comment relates to. (Reference to

the wp_posts table.) • comment_author – Name of the comment author. • comment_author_email – Email of the comment author. • comment_author_url – URL for the comment author. • comment_author_IP – IP Address of the comment author. • comment_date – Time and data the comment was posted. • comment_date_gmt – GMT time and data the comment was posted. • comment_content – the actual comment text. • comment_karma – unused by WordPress core, can be used by plugins to help manage

comments. • comment_approved – if the comment has been approved. • comment_agent – where the comment was posted from, eg. browser, operating system

etc. • comment_type – type of comment: comment, pingback or trackback. • comment_parent – refers to another comment when this comment is a reply. • user_id – ID of the comment author if they are a registered user on the site. (Reference

to the wp_users table.)

wp_commentmeta

This table stores any further information related to a comment.

• meta_id – unique number assigned to each row of the table. • comment_id – the ID of the post the data relates to. (Reference to

the wp_comments table.) • meta_key – an identifying key for the piece of data. • meta_value – the actual piece of data.

wp_terms

Terms are items of a taxonomy used to classify objects. Taxonomy what? WordPress allows items like posts and custom post types to be classified in various ways. For example, when creating a post in WordPress, by default you can add a category and some tags to it. Both ‘Category’ and ‘Tag’ are examples of a taxonomy, basically a way to group things together.

To classify this post (how meta of me) I would give it a category of ‘Guide’ and tags of ‘database’ and ‘mysql’. The category and tags are terms that would be contained in this table.

• term_id – unique number assigned to each term. • name – the name of the term.

Page 26: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

• slug – the URL friendly slug of the name. • term_group – ability for themes or plugins to group terms together to use aliases. Not

populated by WordPress core itself.

wp_term_taxonomy

Following the wp_terms example above, the terms ‘Guide’, ‘database’ and ‘mysql’ that are stored in wp_terms don’t exist yet as a ‘Category’ and as ‘Tags’ unless they are given context. Each term is assigned a taxonomy using this table.

The structure of this table allows you to use the same term across different taxonomies. For example ‘Database’ could be used as a category for posts and as a term of a custom taxonomy for a custom post type (think portfolio_category for portfolio items). The term of Database would exist once in wp_terms, but there would be two rows in wp_term_taxonomy for each taxonomy.

• term_taxonomy_id – unique number assigned to each row of the table. • term_id – the ID of the related term. (Reference to the wp_terms table.) • taxonomy – the slug of the taxonomy. This can be the built in taxonomies or any

taxonomy registered using register_taxonomy(). • description – description of the term in this taxonomy. • parent – ID of a parent term. Used for hierarchical taxonomies like Categories. • count – number of post objects assigned the term for this taxonomy.

wp_term_relationships

So far we have seen how terms and their taxonomies are stored in the database, but have yet to see how WordPress stores the critical data when it comes to using taxonomies. This post exists in wp_posts and when we actually assign the category and tags through the WordPress dashboard this is the junction table that records that information. Each row defines a relationship between a post (object) in wp_posts and a term of a certain taxonomy in wp_term_taxonomy.

• object_id – the ID of the post object. (Reference to the wp_posts table.) • term_taxonomy_id – the ID of the term / taxonomy pair. (Reference to

the wp_term_taxonomy table.) • term_order – allow ordering of terms for an object, not fully used.

wp_users

WordPress’ user management is one of its strongest features and one that makes it great as an application framework. This table is the driving force behind it.

• ID – unique number assigned to each user. • user_login – unique username for the user. • user_pass – hash of the user’s password. • user_nicename – display name for the user. • user_email – email address of the user. • user_url – URL of the user, e.g. website address. • user_registered – time and date the user registered.

Page 27: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

• user_activation_key – used for resetting passwords. • user_status – was used in Multisite pre WordPress 3.0 to indicate a spam user. • display_name – desired name to be used publicly in the site, can be user_login,

user_nicename, first name or last name defined in wp_usermeta.

wp_usermeta

This table stores any further information related to the users. You will see other user profile fields for a user in the dashboard that are stored here.

• umeta_id – unique number assigned to each row of the table. • user_id – ID of the related user. (Reference to the wp_users table.) • meta_key – an identifying key for the piece of data. • meta_value – the actual piece of data.

wp_options

The options table is the place where all of the site’s configuration is stored, including data about the theme, active plugins, widgets, and temporary cached data. It is typically where other plugins and themes store their settings.

The table is another example of a vertical key/value pair table to allow it to store all sorts of data for a variety of purposes.

• option_id – unique number assigned to each row of the table. • option_name – an identifying key for the piece of data. • option_value – the actual piece of data. The data is often serialized so must be handled

carefully. • autoload – controls if the option is automatically loaded by the

function wp_load_alloptions() (puts options into object cache on each page load).

Did you know that when performing migrations of databases using WP Migrate DB Pro you can tell the plugin to preserve specific options in the target database using the ‘wpmdb_preserved_options’ filter?

wp_links

During the rise of popularity of blogging having a blogroll (links to other sites) on your site was very much in fashion. This table holds all those links for you.

Nowadays blogrolls are used less and less and as of WordPress 3.5 the administration of links was removed from the admin UI. The table remains in the database for backwards compatibility and you can use the old link manager UI using this plugin.

• link_id – unique number assigned to each row of the table. • link_url – URL of the link. • link_name – name of the link. • link_image – URL of an image related to the link. • link_target – the target frame for the link. e.g. _blank, _top, _none. • link_description – description of the link.

Page 28: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

• link_visible – control if the link is public or private. • link_owner – ID of user who created the link. (Reference to the wp_users table.) • link_rating – add a rating between 0-10 for the link. • link_updated – time and date of link update. • link_rel – relationship of link. • link_notes – notes about the link. • link_rss – RSS address for the link.

Someone has produced a helpful entity relationship diagram to explain the relationships between all the tables and posted it on the WordPress codex. This was created at version 3.8 but the structure is still current:

Page 29: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H

Page 30: What is a Content Management System (CMS)? …content management system can be a headache. A CMS is meant to ease the process of adding and modifying new content to a webpage. The

BCA SEM III WORDPRESS Unit-2

Vasavda Rohit H