Custom Tables in WordPress

Jonathan Bossenger
Jonathan BossengerCode instructor/ex-developer en Automattic
1
Custom Tables in WordPress
Jonathan Bossenger
Learn.WordPress.org
2
👋🏽 Welcome!
As you join, let everyone know in the chat where you’re
joining us from…
Hello!
○ My name is Jonathan Bossenger
○ From Cape Town, South Africa
○ Developer educator at Automattic
○ Sponsored to work with the Training Team
○ jonathanbossenger.com
Learn.WordPress.org
Custom tables in WordPress
Jonathan Bossenger
Announcements
○ Welcome, and thanks to Tracy for co-hosting.
○ Please let me know if you can’t see this slide!
○ We are presenting in focus mode, but please feel free to enable your video.
○ You are welcome to ask questions.
○ You are welcome to post questions in the chat, or unmute to ask questions.
Announcements
○ Make sure your local install is ready
○ If I am going too fast, please let me know!
○ We will be posting this session to https://wordpress.tv/ afterwards
○ For WordPress tutorials and courses please visit https://learn.wordpress.org/
○ For WordPress developer news and updates please visit
https://developer.wordpress.org/news/
Learning outcomes
○ The fundamentals of creating and managing custom WordPress tables.
• When you should consider a custom table
• Where to find documentation
• How to create a custom table
• How to select, add or update data in a custom table
• A brief overview of table updates
• Cleaning up your custom tables
Requirements
○ A local WordPress install
○ A text editor
○ A way to access your database
• https://wordpress.org/plugins/sql-buddy/
○ The wp-learn-database.php script in the root of your WordPress installation
• https://gist.github.com/jonathanbossenger/d96520acd6225ea969f091752a3bca8b
○ An empty plugin
Let’s go!
Resources
○ https://codex.wordpress.org/Creating_Tables_with_Plugins
○ https://developer.wordpress.org/reference/functions/register_activation_hook/
○ https://developer.wordpress.org/reference/functions/register_deactivation_hook/
○ https://developer.wordpress.org/reference/classes/wpdb/
○ https://wordpress.stackexchange.com/questions/4852/post-meta-vs-separate-database-tables
1 de 9

Más contenido relacionado

Similar a Custom Tables in WordPress(20)

Common WordPress APIs_ InternationalizationCommon WordPress APIs_ Internationalization
Common WordPress APIs_ Internationalization
Jonathan Bossenger21 vistas
Common WordPress APIs - Dashboard WidgetsCommon WordPress APIs - Dashboard Widgets
Common WordPress APIs - Dashboard Widgets
Jonathan Bossenger99 vistas
Common WordPress APIs: Responsive ImagesCommon WordPress APIs: Responsive Images
Common WordPress APIs: Responsive Images
Jonathan Bossenger66 vistas
Common WordPress APIs_ Settings APICommon WordPress APIs_ Settings API
Common WordPress APIs_ Settings API
Jonathan Bossenger52 vistas
Common WordPress APIs - Options APICommon WordPress APIs - Options API
Common WordPress APIs - Options API
Jonathan Bossenger48 vistas
Common WordPress APIs_ Global VariablesCommon WordPress APIs_ Global Variables
Common WordPress APIs_ Global Variables
Jonathan Bossenger36 vistas
The WordPress DatabaseThe WordPress Database
The WordPress Database
Jonathan Bossenger52 vistas
Common WordPress APIs: MetadataCommon WordPress APIs: Metadata
Common WordPress APIs: Metadata
Jonathan Bossenger64 vistas
Help test WordPress - developer editionHelp test WordPress - developer edition
Help test WordPress - developer edition
Jonathan Bossenger34 vistas
The WordPress Request LifecycleThe WordPress Request Lifecycle
The WordPress Request Lifecycle
Jonathan Bossenger32 vistas
The WordPress HTML APIThe WordPress HTML API
The WordPress HTML API
Jonathan Bossenger42 vistas
Let's code: WordPress multisite experimentsLet's code: WordPress multisite experiments
Let's code: WordPress multisite experiments
Jonathan Bossenger14 vistas
Debugging in WordPressDebugging in WordPress
Debugging in WordPress
Jonathan Bossenger20 vistas
Using Block Patterns in your Block Theme.pptxUsing Block Patterns in your Block Theme.pptx
Using Block Patterns in your Block Theme.pptx
Jonathan Bossenger26 vistas
Testing plugins for PHP 8Testing plugins for PHP 8
Testing plugins for PHP 8
Jonathan Bossenger45 vistas

Más de Jonathan Bossenger(12)

Common WordPress APIs_ HTTP API.pptxCommon WordPress APIs_ HTTP API.pptx
Common WordPress APIs_ HTTP API.pptx
Jonathan Bossenger19 vistas
WordPress Coding StandardsWordPress Coding Standards
WordPress Coding Standards
Jonathan Bossenger116 vistas
Managing a WordPress Multisite NetworkManaging a WordPress Multisite Network
Managing a WordPress Multisite Network
Jonathan Bossenger12 vistas
Introduction to WordPress Multisite NetworksIntroduction to WordPress Multisite Networks
Introduction to WordPress Multisite Networks
Jonathan Bossenger15 vistas
Developing for multisiteDeveloping for multisite
Developing for multisite
Jonathan Bossenger107 vistas
Custom Post Types and Capabilities.pptxCustom Post Types and Capabilities.pptx
Custom Post Types and Capabilities.pptx
Jonathan Bossenger25 vistas
Creating a WordPress multisite networkCreating a WordPress multisite network
Creating a WordPress multisite network
Jonathan Bossenger49 vistas
WP REST API - custom routes and endpointsWP REST API - custom routes and endpoints
WP REST API - custom routes and endpoints
Jonathan Bossenger31 vistas
WP REST API - modifying responsesWP REST API - modifying responses
WP REST API - modifying responses
Jonathan Bossenger13 vistas

Último(20)

Java Platform Approach 1.0 - Picnic MeetupJava Platform Approach 1.0 - Picnic Meetup
Java Platform Approach 1.0 - Picnic Meetup
Rick Ossendrijver24 vistas

Custom Tables in WordPress

  • 1. 1 Custom Tables in WordPress Jonathan Bossenger Learn.WordPress.org
  • 2. 2 👋🏽 Welcome! As you join, let everyone know in the chat where you’re joining us from… Hello! ○ My name is Jonathan Bossenger ○ From Cape Town, South Africa ○ Developer educator at Automattic ○ Sponsored to work with the Training Team ○ jonathanbossenger.com
  • 3. Learn.WordPress.org Custom tables in WordPress Jonathan Bossenger
  • 4. Announcements ○ Welcome, and thanks to Tracy for co-hosting. ○ Please let me know if you can’t see this slide! ○ We are presenting in focus mode, but please feel free to enable your video. ○ You are welcome to ask questions. ○ You are welcome to post questions in the chat, or unmute to ask questions.
  • 5. Announcements ○ Make sure your local install is ready ○ If I am going too fast, please let me know! ○ We will be posting this session to https://wordpress.tv/ afterwards ○ For WordPress tutorials and courses please visit https://learn.wordpress.org/ ○ For WordPress developer news and updates please visit https://developer.wordpress.org/news/
  • 6. Learning outcomes ○ The fundamentals of creating and managing custom WordPress tables. • When you should consider a custom table • Where to find documentation • How to create a custom table • How to select, add or update data in a custom table • A brief overview of table updates • Cleaning up your custom tables
  • 7. Requirements ○ A local WordPress install ○ A text editor ○ A way to access your database • https://wordpress.org/plugins/sql-buddy/ ○ The wp-learn-database.php script in the root of your WordPress installation • https://gist.github.com/jonathanbossenger/d96520acd6225ea969f091752a3bca8b ○ An empty plugin
  • 9. Resources ○ https://codex.wordpress.org/Creating_Tables_with_Plugins ○ https://developer.wordpress.org/reference/functions/register_activation_hook/ ○ https://developer.wordpress.org/reference/functions/register_deactivation_hook/ ○ https://developer.wordpress.org/reference/classes/wpdb/ ○ https://wordpress.stackexchange.com/questions/4852/post-meta-vs-separate-database-tables