Last active
October 1, 2018 18:55
-
-
Save woogists/4267c0a78f1e940af6b31bea73e0f5be to your computer and use it in GitHub Desktop.
[Returns and Warranty Requests] Add custom statuses
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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