Making WordPress.org

Changeset 1720


Ignore:
Timestamp:
07/09/2015 11:47:53 PM (9 years ago)
Author:
iandunn
Message:

WordCamp Post Type: Insert term slug when creating sponsorship level.

If the term on Central has a slug different from it's sanitized title, then we'd previously end up with two terms being created; e.g., "Splended Sponsor" (the title), and "splended" (the slug).

There's also no need to loop through every sponsor, since they'll all have the same $sponsorship_level object; we can just use the first.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-wordcamp/wordcamp-new-site.php

    r1718 r1720  
    559559    protected function create_sponsorship_levels( $assigned_sponsors ) {
    560560        foreach( $assigned_sponsors as $sponsorship_level_id ) {
    561             foreach ( $sponsorship_level_id as $sponsor ) {
    562                 wp_create_term(
    563                     $sponsor->sponsorship_level->post_title,
    564                     'wcb_sponsor_level'
    565                 );
    566             }
     561            $sponsorship_level = $sponsorship_level_id[0]->sponsorship_level;
     562
     563            wp_insert_term(
     564                $sponsorship_level->post_title,
     565                'wcb_sponsor_level',
     566                array(
     567                    'slug' => $sponsorship_level->post_name
     568                )
     569            );
    567570        }
    568571    }
Note: See TracChangeset for help on using the changeset viewer.