SQL to turn comments off on all posts and pages:
UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'post';
UPDATE wp_posts SET comment_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
UPDATE wp_posts SET ping_status='closed' WHERE post_status = 'publish' AND post_type = 'page';
Please backup your database before proceeding.
Related:
WordPress Backups
Database Description
phpMyAdmin
And of course don’t forget to fix your settings in Administration > Settings > Discussion
But I don’t want to disable comments, I just want to disable pingbacks and trackbacks, should I just use the ones below?
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';
Thanks
PS: you placed two ‘page’ on your ping status code. 🙂
Oops, messed up…try
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';
Worked perfectly MichaelH, now I have to find how to globally remove tags with zero posts. If you know a SQL magic, kindly please let me know, here’s my thread..
How to globally clean null or empty tags?
http://wordpress.org/support/topic/311621
Thanks in advance…
I think there are two identical lines in the first sql sentences from MichaelH: Thirst and fourth lines.
Perhaps the difference should be “page” and “post”, and not “page” in both lines.