Add order to positions during preset installation

This commit is contained in:
Brian Miyaji
2017-11-18 20:15:47 +11:00
parent 67ca8fd084
commit 790ed97d86

View File

@@ -108,13 +108,13 @@ class SP_Admin_Sports {
$name = sp_array_value( $position, 'name', __( 'Position', 'sportspress' ) );
$sections = sp_array_value( $position, 'sections', array( 0, 1 ) );
}
$slug = $i . '-' . sanitize_title( $name );
$term = wp_insert_term( $name, 'sp_position', array( 'slug' => $slug ) );
$term = wp_insert_term( $name, 'sp_position' );
if ( is_wp_error( $term ) ) continue;
$t_id = $term['term_id'];
$term_meta = get_option( "taxonomy_$t_id" );
$term_meta['sp_sections'] = $sections;
update_option( "taxonomy_$t_id", $term_meta );
update_term_meta( $t_id, 'sp_order', $i + 1 );
$i++;
}