I love learning new SQL queries for WordPress. The more I learn, the more I see how versatile WordPress truly is.
Mass Disable Pingbacks on Posts and Pages
These queries mass disable Pingbacks on Posts and Pages for published pages. The alternative to these queries is opening each page one by one to untick the Pingback feature.
UPDATE wp_posts SET ping_status='closed' WHERE post_status='publish' AND post_type='post';
UPDATE wp_posts SET ping_status='closed' WHERE post_status='publish' AND post_type='page';
Set All Users' Display Name (Nice Name) to their User ID
This isn't as SEO friendly as having intelligible display names but this could be useful if you have a members only website, are using emails as user names, or otherwise need to anonymize your user base. For example, the query below will change your author URL to something like this: yourwebsite.com/author/73/.
UPDATE wp_users SET user_nicename=ID;
- If you want a little more precision, you can set a new display name depending on the login name. Be sure to change newDISPLAYname and yourLOGINname to your actual values or this query will not update any entries.
UPDATE wp_users SET user_nicename='newDISPLAYname' WHERE user_login='yourLOGINname';
- If for some reason you can't remember your login name or need to see a list of user logins, then run this query:
SELECT user_login FROM wp_users;
Check out the other useful post, Useful Tweaks For WordPress.
What else would you like to see here? I may add more useful SQL queries For WordPress here in the future.