Get the App
SLTechnology News&Howtos  ›  Database  › 

What are the SQL operation statements in WordPress

Shulou Source: shulou.com Published: 2022-05-31 19:20:41 10月04日 Update

What this article shares to you is about what SQL operation statements are in WordPress, the editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article.

What are the SQL operation statements of WordPress

1. Delete all unused tags

DELETEa,b,c

FROMwp_termsASa

LEFTJOINwp_term_taxonomyAScONa.term_id=c.term_id

LEFTJOINwp_term_relationshipsASbONb.term_taxonomy_id=c.term_taxonomy_id

WHEREc.taxonomy='post_tag'ANDc.count=0

two。 Delete all revised versions of articles (Revisions) and their Meta data

DELETEa,b,c

FROMwp_postsa

LEFTJOINwp_term_relationshipsbON (a.ID=b.object_id)

LEFTJOINwp_postmetacON (a.ID=c.post_id)

WHEREa.post_type='revision'

3. Change the WordPress address and home address

UPDATEwp_options

SEToption_value=replace (option_value,' http://www. old URL .com', 'http://www. new URL .com')

WHEREoption_name='home'ORoption_name='siteurl'

4. Change the GUID of an article

UPDATEwp_posts

SETguid=REPLACE (guid,' http://www. old URL .com', 'http://www. new URL .com')

5. Change the link address in the body

UPDATEwp_posts

SETpost_content=REPLACE (post_content,' http://www. old URL .com', 'http://www. new URL .com')

6. Update the meta value of an article

UPDATEwp_postmeta

SETmeta_value=REPLACE (meta_value,' http://www. old URL .com', 'http://www. new URL .com'

7. Reset Admin password

UPDATEwp_users

SETuser_pass=MD5 ('new_password')

WHEREuser_login='admin'

8. Reset the user name of admin

UPDATEwp_users

SETuser_login='newname'

WHEREuser_login='admin'

What are the SQL operation statements of WordPress

9. Transfer all the articles of author a to author b

UPDATEwp_posts

SETpost_author='b'

WHEREpost_author='a'

10. Delete the meta tag of an article

DELETEFROMwp_postmeta

WHEREmeta_key='your-meta-key'

11. Export email addresses in all comments

SELECTDISTINCTcomment_author_email

FROMwp_comments

twelve。 Delete all Pingback

DELETEFROMwp_comments

WHEREcomment_type='pingback'

13. Delete all spam comments

DELETEFROMwp_comments

WHEREcomment_approved='spam'

14. Disable all active plug-ins

UPDATEwp_options

SEToption_value=''

WHEREoption_name='active_plugins'

15. List all unused Meta tags

SELECT*

FROMwp_postmetapm

LEFTJOINwp_postswpONwp.ID=pm.post_id

WHEREwp.IDISNULL

16. Turn off the messages of old articles

UPDATEwp_posts

SETcomment_status='closed'

WHEREpost_date

Tags: URL article statement address label update author more text knowledge article comment utility spam password that is work meeting plug-in data activation Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Microsoft Shulou Technology OPPO Reno Redmi