Removing Category Alias From WooCommerce Products Link Address

Removing Category Alias From WooCommerce Products

When performing website optimization, more attention is paid to the link address, and it is best not to use long addresses. When using the e-commerce site WooCommerce as a product, there are product category aliases such as product-category in the product link address. Many people are uncomfortable with this address, so they try to get rid of this.

How to remove the category alias from the link address (URL)

There are two ways to use this method, one is to use code and the other is to use plug-ins.

Use code to remove category aliases in WooCommerce product link address

Put the following code in the functions.php file of the website:

add_filter (‘term_link’, ‘term_link_filter’, 10, 3);

function term_link_filter ($ url, $ term, $ taxonomy) {

    $ url = str_replace ("/./","/",$ url);

     return $ url;

}

The above code may not be effective for all websites.

Remove category aliases By plug-in (WooCommerce Permalink Manager)

WooCommerce Permalink Manager

WooCommerce Permalink Manager is developed to modify and improve the current WooCommerce URL configuration function and provide the store with better display options and additional SEO features to comply with WooCommerce SEO standards.

Main advantages of WooCommerce Permalink Manager plugin

  • Automatically adding the ‘rel = canonical’ attribute can eliminate duplicate pages in search results and is highly recommended by most search engines.
  • Enhanced working rapidity, even in online stores with a bulky number of products (over 100K).
  • A dedicated settings interface allows users to set all permanent link settings for their online store on one page.
  • It has been tested and is compatible with the main WooCommerce plugin.

WooCommerce Permalink Manager plugin function

  • The capability to create a product URL.
  • The ability to generate product URLs, that contains products and main categories of slugs.
  • The ability to generate product URLs, which contains product slugs and their category hierarchy.
  • The capability to create a product category URL.
  • The product category URL can be generated in such a way that only its slug and category hierarchy can be seen.
  • Ability to select main categories to generate product URLs.
  • Automatically add the ‘rel = canonical’ attribute to copy pages to improve SEO.

First, download and install and activate: WooCommerce Permalink Manager. There will be several

options for you to choose:

link address

For example, if you like the shortest address, choose the Category slug.

You May Also Like

About the Author: BW

Leave a Reply

Your email address will not be published. Required fields are marked *