WooCommerce- How to remove product & product-categ

2019-02-08 05:11发布

问题:

I'm using WooCommerce on a WordPress and it adds product & product-category to the URLs. http://dev.unwaveringmedia.com/8dim/product-category/all-party-supplies/ http://dev.unwaveringmedia.com/8dim/product/14-snowman-serving-tray/

I need to remove 'product' & 'product-category' from the URLs. Is there any way to modify the permalinks and remove them?

回答1:

Its good practice for SEO and UX to have a product category base. Product category bases help to distinguish products from posts. I usually change the product category base to "our-products" or "products".

To do this go to settings->permalinks-> enter your desired product category base.



回答2:

There is an official answer to this in the WooCommerce documentation.

A snippet:

Unfortunately this is not possible due to the way WordPress resolves its URLs. It uses the ‘product-category’ (or any other text for that matter) base of an URL to detect that it is an URL leading to a product category.

There is a bit of followup explanation, and allegedly there are some plugins that make it possible, though it's not recommended.

You may also be able to 'hack' the core code and just change the strings they use for that permalink structure -- or maybe that's what the elsewhere-mentioned setting is intended to do?