New Video: How to run SQL Queries in WordPress using WPCodeBox

Table of Contents

Back to Blog

In this video, I show you how to run SQL Queries using snippets that run manually in WPCodeBox. To exemplify this, I use a few examples from Jeff Starr’s new book about SQL in WordPress.

First Example: How to replace an URL (or any string) in the post content

In this example, I show you how to run a snippet that will replace an URL or any other string in the post content. This is super-useful when you want to batch edit multiple posts.

Second Example: How to find all the posts that have been modified in the last month

In this example, I show you how to find all the posts that have been modified using an SQL query. This example can be modified to load posts based on any number of conditions.

Conclusion

The ability to run SQL queries in WordPress is a very powerful skill to have. If you wnt to read more about SQL in WordPress in general, do check Jeff Starr’s new book:

https://m0n.co/wizards-sql
https://m0n.co/wizards-sql-demo

The Most Powerful Code Snippets Plugin

Save hours when customizing WordPress sites.
Manage Snippets in WordPress
Works with All Plugins
Send Snippets to the Cloud
A Better Code Editor
Conditionally Run Snippets
Works Locally, or In the Cloud

Get WPCodeBox, the most powerful WordPress Code Snippet Manager.

Save hours when customizing WordPress sites.
WPCodeBox is a WordPress Code Snippets Manager that allows you to share your WordPress Code Snippets across your sites.