Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the SQL operation statements in WordPress

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

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

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report