See the following code:
WordPress used for a long time, some post deleted, but its corresponding post meta data still exist, then how to delete these isolated post meta data? Run the following SQL statement directly in the database management software:
DELETE pm
From Wp_postmeta PM
Left JOIN wp_posts wp on wp.id = pm.post_id
WHERE Wp.id is NULL
----puzzled is, "PM", "WP" what mean?
Reply to discussion (solution)
In the case of SQL instructions, PM is the alias of table Wp_postmeta, WP is the table name of table wp_posts
A little refresher on database knowledge can be recalled.
The label's record is stored in the Wp_terms data sheet. Sometimes, some tags may be created but not used, and they will still be in the datasheet. The following statements can be queried for these unused tags, and you can safely delete them.
SELECT * from wp_terms wt INNER joins wp_term_taxonomy WTT on wt.term_id=wtt.term_id WHERE wtt.taxonomy= ' Post_tag ' and WTT. Count=0
----Thank you for reminding me. I have reviewed it more than once, but I have not been able to tell this usage anywhere. Just saw a similar usage, such as the WT WTT. Ask Tall man, what is the usage of the red font part?
I see. The Red font section WT WTT is the alias of Wp_terms, Wp_term_taxonomy. What I don't understand is that in the following code:
DELETE pm
From Wp_postmeta PM
Left JOIN wp_posts wp on wp.id = pm.post_id
WHERE Wp.id is NULL
Did----Delete pm remove the entire Wp_postmeta table? And that's not what we meant! We just want to delete the isolated Post Meta data.
Also please expert guidance
He doesn't have where wp.id is NULL?