Skip to content

Instantly share code, notes, and snippets.

@levantoan
Last active November 19, 2022 05:50
Show Gist options
  • Select an option

  • Save levantoan/b3baea54158280e42260eb124f6e6a5f to your computer and use it in GitHub Desktop.

Select an option

Save levantoan/b3baea54158280e42260eb124f6e6a5f to your computer and use it in GitHub Desktop.
Remove product-category and all parents slug product category in link Woocommerce
<?php
/***************************
* Loại bỏ toàn bộ slug của category cha và product-category ra khỏi URL
* Remove all parents slug product category link
* Author: http://levantoan.com
* Example
Product category url: http://domain.com/product-category/computer
Product child category url level 1: http://domain.com/product-category/computer/laptop
Product child category url level 2: http://domain.com/product-category/computer/laptop/dell
* Change to
Product category url: http://domain.com/computer
Product child category url level 1: http://domain.com/laptop
Product child category url level 2: http://domain.com/dell
* Code
Read more here: http://levantoan.com/xoa-bo-product-category-va-toan-bo-slug-cua-danh-muc-cha-khoi-duong-dan-cua-woocommerce/
***************************/
@gerharddt
Copy link
Copy Markdown

Is it possible to make the product child category url level 2/3 to look like: http://domain.com/laptop/dell/another

@DrMTR
Copy link
Copy Markdown

DrMTR commented Sep 25, 2017

im interested in the same ^

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment