You need to use action to get categories. in init
action you can get product categories.
add_action('init', 'my_product_cat');
function my_product_cat() {
$woo_cat_args = array(
'taxonomy' => 'product_cat',
'orderby' => 'name',
'hide_empty' => 0,
);
$woo_categories = get_categories( $woo_cat_args );
echo "<pre>";
print_r($woo_categories);
echo "</pre>";
}
Related Posts:
- How can I select a primary category?
- Display empty taxonomy terms with get_terms()
- Display custom taxonomy attached to the post on post single page
- Display List of Categories Within a Custom Taxonomy
- Is There a Difference Between Taxonomies and Categories?
- Check if a post is in any child category of a parent category
- How to export and import taxonomies (category, tag and/or custom taxonomy) and their terms
- get_categories for custom post type with a specific custom taxonomy attached
- Woocommerce get category image full size
- Order get_terms() By Custom Field
- Control term order on a per-post basis
- How can I add the featured image functionality to a custom taxonomy?
- Combine two taxonomies in a hierarchical tree
- Programmatically create product category and add thumbnail in woocommerce
- How to make custom taxonomy check boxes like ‘Categories’
- Are Categories, Tags and Custom Taxonomies any different in regards to SEO?
- How to create non-unique sub-category slugs?
- How to get next previous category in same taxonomy?
- Does WordPress Offer a Way to Find All of the Categories that Don’t Have Children?
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- Removed slug from CPT, now How/where do I hook the filter to the taxonomy term archive pages link?
- Use get_term_children to get the sub category of a parent category for the current post
- Getting WordPress custom taxonomy/category?
- Get a list of Terms for a specific category
- How to get the number of child categories a specific parent category has?
- How can I convert some categories to a custom taxonomy?
- Get multidimensional array that reflects category hierarchy
- List Terms in Category
- display taxonomy slug from term ID
- Set post categories to include parents when setting child category
- Limit number of terms that a custom taxonomy can save per custom post type
- Change existing taxonomy settings when using custom taxonomy
- Display Taxonomy Terms in an option tag with value being the slug
- How to get the id from the custom category?
- How can i insert term in a specific language of Polylang?
- Why does the argument list_only do on Walker_Category_Checklist::start_el?
- Display Posts Loop for each parent and for each Child
- Is There a Difference Between Taxonomies and Categories?
- How can I edit the ‘Most Used’ tab in the categories meta-box to show another custom taxonomy?
- Get posts from specific taxonomy term
- Get posts under a category with SQL
- get_terms function not returning anything
- Ive got a term (get_term_by) but now I want to filter it by a category it is in?
- Include WooCommerce product to all child categories
- Question on using custom structures for categories
- Get Categories Where Taxonomy Equals ‘n’
- Display sibling categories on category page
- Echo text using is_tag
- List just subcategory and products of active category page in Woocommerce
- Exclude product attributes from taxonomy terms loop
- Grandchild Term Things Grandfather Term is It’s Parent
- Same menu for different taxonomies to reach different content
- Showing HTML if Post is In Certain Taxonomy Term
- How could I write a get_categories_by_year() function?
- Post to inherit custom category background image from parent
- How to get posts using category slug in ClassiPress?
- Combining these queries? (Same taxonomy term + same category as post)
- List taxonomy terms assigned to a post in hierarchical view
- How to set the same base url for two different taxonomies?
- Ordering terms whilst in loop
- How to set acf color field as background color to product category
- How to target all woocommerce categories that don’t have any subcategories in them?
- Show the parent taxonomy by creating shortcode in woocommerce?
- Cloning product not copying custom taxonomies
- When creating a new product, auto assign it to all custom taxonomy woocommerce
- Restrict retrieved terms by category?
- How to load terms of a custom taxonomy of a product in woocommerce cart page
- outputting taxonomy hierarchy
- Why use hierarchical taxonomies instead of many custom taxonomies?
- Renaming default category taxonomy?
- Categories and Tags Conflict after Woocommerce Installation
- How to Manage and link certain custom taxonomy?
- How to add a post with new Taxonomy without assigning to default category?
- List Terms by category
- get_adjacent_post_link excluded_terms ignored
- Why is my post categories not displaying?
- Problem importing categories and sub-categories
- Display woocommerce product_cat child terms with thumbnails
- Converting Categories (with ACF fields) to custom taxonomies
- Woocommerce custom taxonomy order
- Issue On Listing Woocommerce Parent Tag List
- Taxonomy term RestApi data 10 rows limitions
- hide_empty property not working when using get_terms
- Add custom fields to Woocommerce Category Page
- How do I check if a post has a term with a particular ancestor/parent?
- Share one taxonomy across multiple blogs in 3.0 [duplicate]
- cat_is_ancestor_of() for custom taxonomies
- How to add HTML5 ‘required’ attribute to wp_dropdown_categories() without JavaScripts?
- Taxonomy name repeating when showing 2 posts from each category
- Wacky taxonomy in wordpress
- Migrate the posts of a category to another blog as a custom taxonomy
- Woocommerce only display child category when parent is checked (on add new product page)
- Taxonomy custom check box meta field not getting saved
- In if…else condition, the else statement shows even if if statement is correct
- Woocommerce: all products of all categories instead products of one category
- Image Upload Custom Form Field for Category and Custom Taxonomy
- Woocommerce change tag_id to name
- Category base 404 – fix
- cannot create product attribute (taxonomy) and add terms on the same execution
- Is it possible for post and custom post type to share a category base slug?