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
- WordPress custom slug (endpoint) and compare all links
- get post based on category chosen in drop down – The ajax method
- How to use transient in this code for related post?
- WooCommerce Related Products by Attribute
- Image as Sales Badge
- Global variable $post returning incorrect object
- WooCommerce – Email admin with new user details
- get_term_link() returns incorrect url
- How do you use WP slugs for PDF files / media?
- Creating a related post section based on similar categories
- Swapping wp_dropdown_categories function with wp_category_checklist
- Automatically remove a canceled order in Woocommerce
- Call global variable array() in woocommerce child/template
- Get custom category image from menu
- Remove price from Woocommerce variable product dropdown menu
- get_term_link() returns correct – But illogical error-messages disturb
- Proper syntax or method for keeping url in modified isotope / category links
- Adding nofollow to a PHP generated Nav
- Can I prevent the user from adding more than two levels deep of terms inside of a taxonomy metabox?
- Display Taxonomy Terms in an option tag with value being the slug
- Filter Select results based on selection
- WordPress plugin for nicer looking slugs? Have multiple pages named the same but they get different slugs
- get a simple array of all of the term names that exist in all taxonomies
- PHP Warning: Attempt to read property “term_id” on bool
- Automated Cart Update With Alert Box Each Time
- Two Different Links for Same Product – WooCommerce [closed]
- WooCommerce/WordPress: how hide entire table form after submit (Admin Dashboard)?
- What query string parameter is available for index.php, that works for both pages and blog articles?
- Why my filterable portfolio page work not perfectly between slug button and slug output WORDRPESS?
- dividing sub-categories by parent category – WordPress
- Show prices with tax in Woocommerce Mini Cart [closed]
- How to exclude category ID from Looper in WordPress
- Add a specific part of current category page url to shortcode
- php script to change slug in post automatically
- Woocommerce product variation backorder
- Status 400 for AJAX POST Request with admin-ajax.php
- how do I get a specific post from a post with a subcategory in WP
- Problem with custom plugin using AJAX to pull info from php file
- Woocommerce hook run after an Order been created through REST API
- How can I apply_filters from inside a function?
- Get and insert order email address to the PHP template inside HTML text
- WP grandchild categories in nested ul li
- Modify HTML structure of fields in woocommerce checkout form
- Grab posts by multiple categories
- Auto-update products after they were published – Woocommerce
- How to VAR_DUMP a $variable during checkout process (Is my product meta callable?)
- Reload part of checkout on changed shipping method
- How to show single category archive
- How to get all shipping rates and costs without session in woocommerce?
- Move category description below post list in blog
- Display a specific category of products in shop page and disable code for specific actions
- If no products are on sale – hide ID or class
- Woocommerce related product text
- Woocommerce api: create product with images – bad request
- Trying to build simple deposit code that hooks into woocommerce
- WooCommerce Webhooks not firing because of error in wp-includes/meta.php
- Different Minimum Order Amounts based on Shipping Zone [closed]
- How to pick the default selected value in wordpress dropdown?
- do search in two site and show the result in first site
- Woocommerce: hook action/filter I could use to add variation id and price with each attribute opt on WooCommerce Rest api
- Add a product to checkout via form