Created
November 7, 2021 12:36
-
-
Save bencicpatricija/3eec5e8345202c7b06d4838219dff112 to your computer and use it in GitHub Desktop.
Get "Uncategoriezed" term ID from "product_cat" taxonomy
This file contains hidden or 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
/** | |
* Get "Uncategorized" term ID from "product_cat" taxonomy. | |
*/ | |
function pb_get_product_uncategorized_term_id() { | |
$uncategorized_term_id = get_term_by( 'slug', 'uncategorized', 'product_cat')->term_id; | |
if ( ! class_exists( 'woocommerce' ) || ! $uncategorized_term_id ) { | |
return false; | |
} else { | |
return $uncategorized_term_id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment