How to Remove WooCommerce Category Extension

One of the issues that WooCommerce users suffer the most is long connection structures. In this article, I will talk about a feature that can make a serious contribution to your website’s position in search engines. With the plugin that I will share with you below, you will be able to easily get rid of […]

How to Remove WooCommerce Category Extension

One of the issues that WooCommerce users suffer the most is long connection structures. In this article, I will talk about a feature that can make a serious contribution to your website’s position in search engines. With the plugin that I will share with you below, you will be able to easily get rid of the “product-category” link at the top of your product categories. With this plugin, you can simplify your WooCommerce product categories with just 2 simple steps.

Important: If you install this plugin on an already active site, your old links will be lost.

That’s why you should first make a 301 redirect to new links without losing the old links. Don’t forget to install the Redirection plugin and point the old extensions to the new extensions. If you are having trouble installing and using Redirection, please let me know in the comments section.

WooCommerce Category Extension Removal Plugin

Register the “Remove product-category slug” plugin developed by Timersys and distributed as open source, and install it on your WordPress site from Plugins> Add New> Upload Plugin.

get_var( $wpdb->prepare( "SELECT t.term_id FROM $wpdb->terms t LEFT JOIN $wpdb->term_taxonomy tt ON tt.term_id = t.term_id WHERE tt.taxonomy = 'product_cat' AND t.slug = %s" ,array( $slug )));
		if( $exists ){
			$old_vars = $vars;
			$vars = array('product_cat' => $slug );
			if ( !empty( $old_vars['paged'] ) || !empty( $old_vars['page'] ) )
				$vars['paged'] = ! empty( $old_vars['paged'] ) ? $old_vars['paged'] : $old_vars['page'];
			if ( !empty( $old_vars['orderby'] ) )
	 	        	$vars['orderby'] = $old_vars['orderby'];
      			if ( !empty( $old_vars['order'] ) )
 			        $vars['order'] = $old_vars['order'];	
		}
	}
	return $vars;
});

Copy the above code and save it as remove-category.php with Notepad, Notepad ++ or Dreamweaver or a similar program. Then activate the relevant file by converting it into a .zip file and upload it from the plugin download area.

After activating the plugin, there is no settings window for the plugin. Just visit the Settings> Permanent Links page and type “./” in the Product category basis field and press the save button.

klkjk

After this process, the “product-category” link in your WooCommerce categories will be removed. Check out the links below for an example usage.

Old Link

wpservis.com/product-category/category-name

New Link

wpservis.com/category-name

If you have followed all the steps correctly, the category extension will be removed. If you need help with installing and using the plugin, please let me know in the comments section.

Leave a Reply

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