Skip to content

Instantly share code, notes, and snippets.

@dbernar1
Created November 23, 2012 04:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dbernar1/4133966 to your computer and use it in GitHub Desktop.
Save dbernar1/4133966 to your computer and use it in GitHub Desktop.
Setting some options through enabling a theme. In this case, comments and pingbacks are disabled by default in posts/pages, and timezone is Winnipeg.
add_action( 'after_switch_theme', 'dbfds_disable_comments' );
function dbfds_disable_comments( $theme_name ) {
update_option( 'default_comment_status', 'closed' );
update_option( 'default_ping_status', 'closed' );
update_option( 'timezone_string', 'America/Winnipeg' );
}
@pjohanneson
Copy link

Nice.

@pjohanneson
Copy link

Does it need the $theme_name in the function call? Doesn't look like it gets used in the function...

@dbernar1
Copy link
Author

Hi vodou,

Not sure why the system didn't notify me of your comment.

$theme_name is passed to, though not used in my particular hook function, so I suppose I could have left it out. Not sure whether that would have raised a PHP notice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment