WordPress blog publishing platform allows individual author to override global discussion setting and set whether to allow reader to post comment on the article, or whether to allow link notification (aka pingback and trackback) from other blogs at single post or page level. The feature allows all new posts and pages to be created with comments and pings on, but can always be turned off on specific posts or pages when needed.

When come to time to housekeeping, WordPress does not provide an easy way to list or show all posts or paged articles that has its comments and pings off. For blog administrators who want to see a list blog posts and articles that have forbid readers and visitors to leave comments, and stop other blogs to pingback or trackback, use the following trick to list out all posts and pages that are currently set to comment and pingback/trackback off.

Log on to the MySQL database that powers the WordPress blog, and then use the following SQL query statement to get all posts or pages that either comment is not allowed, pings (trackback and ping back) is not allowed or both.

SELECT * FROM `wp_posts` where `comment_status` <> 'open' or `ping_status` <> 'open';

Tip: To make the selection from database easier, it’s recommended to use phpMyAdmin or other GUI interface to MySQL DB.

The query above will return all row (both posts and pages in WordPress) that has either “Allow Comments” or “Allow Pings” set to off (untick). To return only articles where comments is not allowed, use only “comment_status”, or “ping_status” for articles that do not allow pingback and trackback.

Both comment_status and ping_status fields have only two easily understand values – open and closed. Open means allow, which closed means disallowed. Once the result is displayed, the posts that have one or both of the criteria can be determined, and changed if required.

Related Posts