skip to content rich footer

stevenclark.com.au

subscibe to the StevenClark.com.au rss feed

Archive for the 'snippets' Category

SQL for Comments and Pings in WordPress

Sunday, August 17th, 2008

Just a snippet of SQL (Structured Query Language) that comes in handy for WordPress. If you have phpMyAdmin on your account you can just cut and paste these two queries into the SQL area and you’re away. What do they do? If you’re being hammered by spam you don’t want to have to revisit every article and shut off comments and pings - in the past I’ve found the WordPress administration area gave unreliable results at times when turning them on and off. This method offers fine grained control.

So the first query just closes all comments and pings on every article. The second opens comments and pings on twenty articles - change the number on the end to suit your needs. So to close them:

update wp_posts set comment_status='closed', ping_status='closed' where comment_status='open' or ping_status='open'

and to reopen them:

update wp_posts set comment_status='open', ping_status='open' where comment_status='closed' or ping_status='closed' order by wp_posts.ID desc limit 20;

skip to top of page

Currently Reading

Andy Clarke's Transcending CSS: the fine art of web design has been sitting on my bookshelf for several months and I've finally made the time to read it from end to end. My favourite thing about this book from the outset is that it's a designer's book, rather than a technician's manual, for web designers. The artwork and direction in Transcending CSS is enhanced by the attention to detail in the feel and texture of the book itself, the size of it's pages and the feel of the cover in your hands. It's definately a book that affords the act of being read. Looking forward to it.