SQL WordPress posts meta tags meta keywords check edit

Check and Edit Meta Tags and Meta Keywords for WordPress Posts in SQL

This article introduces how to check and edit meta tags and meta keywords for WordPress posts in SQL. In workbench, the result of such complex selects is read only, meaning they cannot be edited. So, based on this result, we do another select and edit that...

Shou Arisaka
1 min read
Nov 23, 2025

This article introduces how to check and edit meta tags and meta keywords for WordPress posts in SQL.

Image

Iโ€™m using mysql workbench as the MySQL client.

The relationships are a bit complex.

USE yuis_yuisorgblog  ; # Database name

SELECT ID,post_title,post_status,name,term_id FROM wp_posts
JOIN wp_term_relationships ON wp_term_relationships.object_id = wp_posts.ID
JOIN wp_terms ON wp_terms.term_id = wp_term_relationships.term_taxonomy_id
WHERE post_type = 'post'
    AND post_title REGEXP "."
order by post_date desc
    ;

With the AND post_title REGEXP โ€.โ€ part, you can also filter titles with regular expressions.

In workbench, the result of such complex selects is read only, meaning they cannot be edited. So, based on this result, we do another select and edit that.

Referring to the term_id column in the previous screen, write the IDs of tags you want to edit separated by | and execute the SQL.

SELECT * FROM wp_terms where term_id REGEXP "1|5|6" ;

Image

So, we were able to check and edit meta tags,

Unfortunately, adding/deleting meta tags is also difficult, and Iโ€™m struggling with it.

Share this article

Shou Arisaka Nov 23, 2025

๐Ÿ”— Copy Links