Our Blog: Wordpress Tip – Turn off Allow Pings and Comments by Default

Aug10th

Comments Off

Wordpress Tip – Turn off Allow Pings and Comments by Default

Tags for post entry: Wordpress Tip – Turn off Allow Pings and Comments by DefaultWritten by Jon Webb on September 10th, 2009, Posted in Wordpress |

Tags for post entry: Wordpress Tip – Turn off Allow Pings and Comments by Default

As part of my week long campaign to divulge some useful information about customising Wordpress into a decent Content Management Solution for small businesses I’ve got another top tip – however this is a developer related top tip and involved rummaging around in the database.

The tip

Today’s tip is about how you can turn off the “Allow comments on this post”, and “Allow trackbacks and pingbacks on this post” options by default on your Wordpress site.

Wordpress Discussion Defaults Tick Boxes

Wordpress Discussion Defaults Tick Boxes

The Solution

In the wordpress database, specifically the wp_options table, there are two options under the option_name column called:

  • default_comment_status
  • default_ping_status

If you run the following SQL query against your Wordpress database’ wp_options table:

select option_name, option_value from wp_options where option_name in('default_ping_status', 'default_comment_status');

It yields the following results:

+------------------------+--------------+
| option_name            | option_value |
+------------------------+--------------+
| default_comment_status | open         |
| default_ping_status    | open         |
+------------------------+--------------+

As you can see – the default is always set to allow comments and pings on all new pages and posts. Now, update the option_value column relating to the default_comment_status and the default_ping_status with the value closed. Now Wordpress will no longer allow new pages/blog posts to be saved with these options open to the world. See the following SQL command on how to achieve this.

Note: it’s always wise to backup before making this sort of update, and on a Wordpress MU installation you will want to add a WHERE clause so that you only target the wordpress site you intend to change these options for.

update wp_options set option_value='closed' where option_name in('default_ping_status', 'default_comment_status');

Tada!

Discussion Meta Box with Defaults set to off

Discussion Meta Box with Defaults set to off

See the Wordpress Options Reference documentation for further information.

Share and Enjoy:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • Furl
  • StumbleUpon
  • Technorati
  • LinkedIn
  • TwitThis

Comments are closed.