The first step in the creation of custom data elements to be stored in a custom database table is to create the table itself. This is done by preparing a standard SQL command that specifies the name of the table and its desired structure and then getting WordPress to execute it on the website's database.
This recipe shows how to prepare and execute a query that creates a table to hold bug reports.
You should have access to a WordPress development environment, either on your local computer or on a remote server, where you will be able to load your new plugin files.
- Navigate to the WordPress plugin directory of your development installation.
- Create a new directory called
- Navigate to the directory and create a text file called
- Open the new file in a code editor and add an appropriate header at the top of the plugin file, naming the plugin
Chapter 8 - Bug Tracker.
- Add the following line of code to register...