Skip to content

Instantly share code, notes, and snippets.

@BFTrick
Created September 20, 2013 15:36
Show Gist options
  • Save BFTrick/6639414 to your computer and use it in GitHub Desktop.
Save BFTrick/6639414 to your computer and use it in GitHub Desktop.
Make the product category permalinks non hierarchical. So instead of `shop/clothing/t-shirt/` we'll see `shop/t-shirt/`
@amigoow
Copy link

amigoow commented Sep 11, 2015

You the man!

@optimizamx
Copy link

Still working for me with Wordpress 4.4 and Woocomerce 2.4.12, thanks!

@d-e-z
Copy link

d-e-z commented Apr 21, 2016

Hi, how to make 301 redirects - shop/clothing/t-shirt/ to shop/t-shirt/ ?

@Ebb2
Copy link

Ebb2 commented Apr 26, 2016

Hi, is it possible to keep just the parent and the last subcategory in the url and remove any other sub-categories in the middle?

So instead of 'www.mysite.com/category/mens/clothing/summer/t-shirt/' we'll see 'www.mysite.com/category/mens/t-shirt/'?

Thanks.

@power345
Copy link

Good. Thanks. Problems are as follows, blog articles give error 404. Have solutions?

@stanimirmihov
Copy link

Is this a code that need to be added in functions.php ?

My goals:

  1. When add new product it adds automaticly produkt (product) to the url - https://stanimirmihov.com/produkt/staven-kompleks-stavi-suhojiliq/ . Can I use instead category or tag every time instead this default line?
  2. Same with categories, when I browse otslabvane (weight loss) I have automaticly added text to the URL - https://stanimirmihov.com/produkt-kategoriya/otslabvane/ , Can't I just use https://stanimirmihov.com/the name of the category ?
  3. Same with the tags, when I browse tag otslabvane (weight loss) I have automaticly added text to the URL - https://stanimirmihov.com/produkt-etiketi/otslabvane

It would be much better If I can just use categories and sub categories only for the url and then the permalink from wordpress.

Produkt = Product ; Etiketi = Tags

@thepigeonoftime
Copy link

Hey, does anyone know how to add a filter to include blog posts and pages? So that this setting works globally across wordpress?

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