19 minutes | Mar 10th 2021

505 – Writing SQL to View Data in WordPress

Announcements Did You Know About Reusable Blocks? Introducing WordPress Stories: A New Way to Engage Your Audience WordPress 5.7 Writing SQL to View Data in WordPress There are four types of operations that you can do in SQL: Create Read Update Delete Here are some examples of each: Read SELECT * FROM wp_posts (this will select and display all items in the wp_posts table) SELECT * FROM wp_posts WHERE post_excerpt = ” (this will show all posts/pages, etc that have no excerpt defined Update UPDATE wp_posts SET post_status = 'draft' (this will update all posts/pages/products to draft) UPDATE wp_posts SET post_status = 'draft' WHERE post_type = 'product' (this will mark all products set to draft) Delete DELETE from wp_comments WHERE comment_approved =  'spam' (this will delete all spam comments) View on YourWebsiteEngineer.com
Play Next