SQL query delete post and postmeta by meta key and value
To delete all posts by a specific meta key and optionally meta value I run the following SQL query:
SQL delete orphaned post meta data
When using lots of plugins and different themes or when testing your own custom made theme or plugin, a lot of post meta can remain in your database that is not linked to a post. By applying the following query to your database, you can delete all meta data that is no longer linked to […]
SQL query to add post meta for each WordPress post
To add post meta to all posts (posts with post type “post”) in your WordPress database you should use the following SQL query: To add post meta to another post type, simply change the post type in the WHERE clause.
Extend search with predefined search query strings
Almost every WordPress developer had some annoyance with the basic search functionality of WordPress. Today I customised the search functionality for one of my projects so I am able to add a list of comma separated search query strings to a post where I want it to be found on. So for example a product like “bicycle” needs to […]
SQL query delete duplicate posts
To delete posts with the same post title via SQL I run the following query on the database:
SQL queries update WordPress URLs
Update site url in wp_options: Update guid: Update all urls in post content: Update all urls in meta fields:
SQL query select and delete all posts from specific term
With this SQL query you can select all the posts from a specific term (and post type): With this query you can delete all these posts: