Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[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
You can’t perform that action at this time.