At http://wordpress.stackexchange.com Mike Schinkel answered one of my questions with huge lines of code that almost look like a Wordpress plugin:

if (!class_exists('YourSite_StaticContent')) {
  class YourSite_StaticContent {
    static function on_load() {
    function manage_static_content_posts_columns($columns){
      $new = array();
      foreach($columns as $key => $title) {
        if ($key=='author') // Put the Sections column before the Author column
          $new['sections'] = 'Sections';
        $new[$key] = $title;
      return $new;
    static function manage_posts_custom_column($column){
      global $post;
      switch ($column) {
        case "sections":
          echo get_the_term_list($post->ID, 'section', '', ', ','');
    static function init() {
        'labels' => array(
          'name' => __( 'Static Content' ),
          'singular_name' => __( 'Static Content' ),
          'add_new_item' => 'Add New Static Content',
          'edit_item' => 'Edit Static Content',
          'new_item' => 'New Static Content',
          'search_items' => 'Search Static Content',
          'not_found' => 'No Static Content found',
          'not_found_in_trash' => 'No Static Content found in trash',
        'public' => true,
        'hierarchical' => false,
        'taxonomies' => array( 'section'),
        'supports' => array('title','editor','excerpt'),
        'rewrite' => array('slug'=>'static_content','with_front'=>false),
        'hierarchical' => true,
        'labels' => array(
          'name' => __( 'Section' ),
          'singular_name' => __( 'Section' ),
          'add_new_item' => 'Add New Section',
          'edit_item' => 'Edit Section',
          'new_item' => 'New Section',
          'search_items' => 'Search Section',
          'not_found' => 'No Sections found',
          'not_found_in_trash' => 'No Sections found in trash',
          'all_items' => __( 'All Sections' ),
        'query_var' => true,
        'rewrite' => array( 'slug' => 'section' ),
      if (!get_option('yoursite-static-content-initialized')) {
        $terms = array(
          'Front Page Intro',
          'Front Page Content',
        foreach($terms as $term) {
          if (!get_term_by('name',$term,'section')) {
            wp_insert_term($term, 'section');

If it were you, would you add something like this at the beginning of the code?:

/* Static Content (Thanks to http://mikeschinkel.com/) */

or mention their his name in the GPL licence file (Thanks to...)

or not mention it at all?

5 Answers 5


You are legally obligated to do so under the CC-BY-SA license, however, the Stack Exchange community prefers that instead of copy/pasting the code, you learn from it and write your own code. If you do so, usually a nice credit is appreciated.

Does the license matter? It's not just boring legalese. The CC licenses are very important for Stack Exchange participants—it's a guarantee that you'll get credit for your contributions, a give-and-take relationship. So do please credit according to the attribution requirements, not just because it's legally required, but because it's morally responsible.

  • It is hard to tell. For instance, at which extent I can determine if the person who answers the question is just referencing widely used lines of code or his own's?
    – wyc
    Commented Feb 8, 2011 at 7:36
  • @user143756 Well, it would have to be ubiquitous to not require credit—think of it this way: if it's more than 10 characters, you should probably credit.
    – waiwai933
    Commented Feb 8, 2011 at 7:38
  • @user143756, if in doubt, you could always include the link to the question in your comment.
    – Benjol
    Commented Feb 8, 2011 at 10:33
  • Thanks, I will give credit then.
    – wyc
    Commented Feb 8, 2011 at 14:53

I would at least give them some credit even it is on a different page or on a page that the code is on.


If you weigh "how much did you benefit from their contribution" against "how much does it cost to give them credit", I think the answer will become obvious.


I usually add a link in the code so I can refer to it later myself, as well as complying with the license:

/* Some or all of the following code is from 
   -additional notes as needed-

However you may want to consult with a lawyer on the impact of the license on your code and business model. The share-alike clause may require some or all of your code to be shared under a similar license once you add this code to it. This particular intersection is explored elsewhere:

I'm worried about Stack Overflow content licensing

Is Stack Overflow's use of Creative Commons Attribution-Share Alike (cc-wiki) viral?


Yes, and I think that next to giving this person credits, I would also notify him/her that you are using (extracts of) his/her code.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .