Wordpress Mysql Query tutorials and examples

How to delete orphan wordpress wp_postmeta rows

WordPress keeps the post meta values in wp_postmeta table. When a post is deleted, its meta data may become orphan. It is harmless data but read more

Mysql query to find all yoast meta description

In case you are are using Yoast plugin for SEO and using it to enter meta post description, you can query meta descriptions of all read more

Query to find recently modified posts in WordPress

It can be sometime handy to query recently modified (last month or last few days) posts in wordpress mysql tables. Here are some handy queries: read more

WordPress – an approach to bulk add tags to posts

We’ll bulk add a tag to all posts in a category as a simple use case. But this approach can be modified to handle other read more

WordPress – query to dump all categories

WordPress mysql query to dump all categories (id, slug, name, description, count) SELECT wp_terms.term_id, wp_terms.slug, wp_terms.name, wp_term_taxonomy.description, wp_term_taxonomy.count FROM wp_term_taxonomy join wp_terms on (wp_term_taxonomy.term_id = read more

WordPress – query to dump all posts with featured image

Sometimes we need to dump all post with featured images along with post title and image title. Here is mysql query which lists all posts read more

WordPress – query to dump all tags

WordPress mysql query to display all tags (id, slug, name, description, count) SELECT wp_terms.term_id, wp_terms.slug, wp_terms.name, wp_term_taxonomy.description, wp_term_taxonomy.count FROM wp_term_taxonomy join wp_terms on (wp_term_taxonomy.term_id = read more

WordPress – query to find all posts for a category

Find term_taxonomy_id for a category name Use the following query to find term_taxonomy_id for a category name after replacing “Tutorials” with the category you want read more

WordPress – query to find term_taxonomy_id from category name

Mysql query – Find term_taxonomy_id from category name Use the following query to find term_taxonomy_id for a category name after replacing “Tutorial” with the category read more

WordPress – query to find term_taxonomy_id from tag name

Mysql query – Find term_taxonomy_id for a tag name Use the following query to find term_taxonomy_id for a tag name after replacing “PHP” with the read more

WordPress mysql query to get all custom keys and values for a post

Handy mysql query to get all custom keys and values for a post in wordpress. SELECT wp_postmeta.* FROM wp_postmeta JOIN wp_posts ON wp_posts.ID = wp_postmeta.post_id read more

WordPress mysql query to get all posts with a missing custom field

Handy mysql query to get all posts with a missing custom field. We’ll query post_type=page for the purpose of this tutorial. You will have to read more

WordPress mysql query to get all posts with a specific custom field

Handy mysql query to get all posts with a specific custom field. We’ll query post_type=page for the purpose of this tutorial. You will have to read more

migrate multiple mysql databases using mysqldump on Linux

Sometimes we need to migrate all mysql databases to a new machine. This can be the case when you are migrating your multiple wordpress blogs read more