Website Building » WooCommerce » How Do I Remove a Permalink From WooCommerce?

How Do I Remove a Permalink From WooCommerce?

Last updated on October 1, 2022 @ 5:36 am

If you’re running a WooCommerce store, you may want to remove the permalink from certain products. This can be useful if you want to avoid duplicate content issues, or if you simply don’t want people to be able to access a product page.

There are a few different ways to remove the permalink from a WooCommerce product. The easiest way is to use the WordPress admin interface.

Simply edit the product in question and uncheck the “Enable pretty permalinks” checkbox. This will remove the permalink from that product, and anyone who tries to access the page will be redirected to the home page.

If you don’t want to use the WordPress admin interface, you can also remove the permalink by editing your theme’s functions.php file. Look for the WooCommerce_product_post_type function and add this line of code:

remove_action( ‘init’, ‘woocommerce_product_post_type’, 20 );

This will remove the permalink from all products on your site.

You can also remove the permalink from specific products by using a plugin like Permalink Manager. This plugin gives you fine-grained control over which products have a permalink and which don’t.

Conclusion:

Removing the permalink from a WooCommerce product is relatively easy to do. The easiest way is to use the WordPress admin interface, but you can also do it by editing your theme’s functions.php file or by using a plugin like Permalink Manager.

Madison Geldart

Madison Geldart

Cloud infrastructure engineer and tech mess solver.