I might be completely missing what you want here, but it sounds like you’re saying you want the parent category’s slug to echo out, rather than the parent category’s human readable name.
Rather than this:
echo $parent->name;
You just need this instead:
echo $parent->slug;
You can see a list of the properties here that are returned by the get_term()
function. You can also always use PHP’s print_r()
function on the term object (so, print_r( $parent );
in this case) to see all of the properties you have available to you.
Related Posts:
- retrieve thumbnail from post ID of best selling product in category
- List all categories but exclude current post category on single post page
- Append a term to WooCommerce product existing product category terms
- Problems with function on function.php
- Put a link to a category round a hard coded A HREF
- How to change / delete product short description in Woocommerce
- Get posts with at least one category in common with current post?
- Woocommerce – remove product from category
- Change description on specific WooCommerce product status change
- combine Code 1 with Code 2
- get current product name in functions.php
- What is an equivalent of single_cat_title for getting the slug of the category?
- Issue adding sub category programmatically
- Pass Category Name, Description and Photo into variables to pass to jQuery
- Redirect to another page using contact form 7? [closed]
- List taxonomy term slugs within shortcode (do_shortcode)
- get taxonomy thumbnail and use it as a variable in code
- Include Parent Term in wp_list_categories
- Get all categories post is not in
- Only show size attributes in product box woocommerce when available
- Exclude product attributes from taxonomy terms loop
- WooCommerce: Display product categories to make IF statement
- WordPress custom taxonomy
- Display Sibling WooCommerce Product Categories on Archive Page
- Woocommerce. Get a list of products in the current category on the archive page and product page
- Add Custom Category Description When Empty
- How do I edit the terms output args or array data?
- Add a product category to a specific product via a button
- Allow two posts (from different categories) to have the same slug
- Get nice name of category from slug (remove dashes of category)
- Create category after theme setup and modify the default one
- Hide a specific category title from displaying on site
- random woocommerce categories are not showing when count enabled?
- Exclude a category slug on pagination
- Need Quick Help With Product Category Page
- get_category only returning details for ‘uncategorized’
- Incomplete term slugs output from a foreach loop with get_the_terms
- Product Category Page in Full Width
- Hide child of parent categories already hidden with “get_terms_args” – Woocommerce
- Display all posts in current category
- category not display in word press grammatically
- Add custom taxonomy terms to WordPress menu dynamically & append #slug to url
- How can I set custom order use this function
- Woocommerce – How to get products which have a sale between 20% to 40%? [closed]
- Check if Product is in a Specific Category in Functions.php
- Woocommerce filter cart and category specific quantity [closed]
- get_the_terms – only top level
- Limiting woocommerce line_total decimal length
- Category Thumbnail Display – How to display ONLY the main Category
- How can I use wp_query to show all product data using just the products ID?
- Get stock by custom meta field on all Woocommerce variable products
- Set a condition based on WooCommerce checkout city field while placing order
- How do you use WP slugs for PDF files / media?
- Swapping wp_dropdown_categories function with wp_category_checklist
- Call global variable array() in woocommerce child/template
- If no products are on sale – hide ID or class
- do search in two site and show the result in first site
- How can I pass a custom/dynamic product to the Woocommerce cart?
- How to get post’s current parent term ID?
- how to show only specific category for a template
- How to get private property in parent class into extended class?
- Replace Woocommerce “add to cart” to be “Download” button [closed]
- Woocommerce Email attachments not working – file not being attached
- Get categories names as an array to use it in theme settings
- How to display a custom product field value of a specific category on a Woo Commerce checkout page?
- Personalize checkout text
- How to separate categories with commas?
- Disable if there are no children – Woocommerce
- Show all tags within a category?
- Alphabetically Ordered Category in WordPress
- How to check if a category has a parent and child categories?
- Get category id when SEO URL is turned on
- Trying to display terms from custom taxonomy within function
- How to sort WooCommerce products page by latest in-stock items first?
- WP_Query for woocommerce products with a pattern as a post_title
- Generate images with html2canvas and the woocommerce api
- display the months of a specific category
- List sub categories and corresponding posts of a parent category
- Woocommerce My acount page
- Get WooCommerce products with similar SKU
- Dropdown category field inside repeatable metabox
- Use CSS tag inside PHP code
- Set ACF on order during checkout
- IF statement not working – Any suggestions?
- Get x numbers of a woocommerce category products using Wp_Query
- Get field value and use as variable in php
- Set notification if is two product category in cart
- AJAX to add to cart multiple products woocommerce
- Reverse Cross-Sells (WooCommerce)
- I was wondering if it’s possible to implement card.js on WordPress
- Woocommerce custom field on emails outputs ‘Array’
- How to remove image on single product and get product to span page?
- php string inside shortcode does not work
- Trying to see if page is category or single and displaying title with appropriate heading tag
- Adding placeholder text field to woocommerce checkout [closed]
- How to create categories out of a list of words?
- Send a custom notification to customer on WooCommerce cancelled order status
- How to code bulk order form in wordpress
- Is there a way of displaying related posts from lowest hyrachical order (lowest child category to parent category)
- Find owner of coupon