Skip to content

Instantly share code, notes, and snippets.

@woogists
Last active October 1, 2018 18:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woogists/4267c0a78f1e940af6b31bea73e0f5be to your computer and use it in GitHub Desktop.
Save woogists/4267c0a78f1e940af6b31bea73e0f5be to your computer and use it in GitHub Desktop.
[Returns and Warranty Requests] Add custom statuses
function warranty_add_custom_statuses() {
if (! function_exists('warranty_get_statuses')) return;
// Statuses to add
$statuses = array('Custom Status 1', 'Custom Status 2');
foreach ( $statuses as $status ) {
$term = get_term_by( 'name', $status, 'shop_warranty_status' );
if (! $term ) {
wp_insert_term( $status, 'shop_warranty_status' );
}
}
}
add_action( 'init', 'warranty_add_custom_statuses', 30 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment