Skip to content

Removing pa_ from product attribute URLs in WooCommerce 2.3+

When upgrading to WooCommerce 2.3 or higher, you may notice that any use of custom attribute archives such as /style/vintage (an archive of all products with the “vintage” attribute) no longer work and instead force you to use /pa_style/vintage.

Strangely, this wasn’t addressed in the changelog or release notes, and WooThemes staff only has to say “I believe it could have been that the error was fixed“, referring to a potential URL conflict.

We’re using the cleaner URL style on Nomad Rugs, creating archives for pages such as 6×9 rugs (nomadrugs.com/size/6×9/ (opens in a new tab)) and contemporary styles (nomadrugs.com/style/contemporary/ (opens in a new tab)). We needed to keep these links functioning while upgrading to the latest WooCommerce release, so we put together the below functions.

If you’re mindful of your slugs and categories and want to keep using this cleaner URL style, add this to your child theme’s functions.php or your functionality plugin (opens in a new tab).

https://gist.github.com/razorfrog/4125ffe0677579f5338d0641cf6ea939

Once added, be sure to re-save your Permalink structure to apply these changes.

Categories: Code
A black silhouette of a frog viewed from above, showing its outstretched legs and toes.
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

Please visit our privacy policy for more information regarding the personally identifiable information we collect and how it is used.