unseenmortal
Member
Posted 3 years ago #
I have hundreds of entries that has pingback and trackbacks checked, I want to disable all of them at once. Are there any ways to do it without me updating all my posts one by one? Please help me out, I need to disable it because some spammers are abusing it and its killing my server. Thanks in advance. :)
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
unseenmortal
Member
Posted 3 years ago #
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';
unseenmortal
Member
Posted 3 years ago #
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...
sansatan
Member
Posted 3 years ago #
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.