Title: Custom Post Type Rewrite
Last modified: August 21, 2016

---

# Custom Post Type Rewrite

 *  Resolved [myironlung3](https://wordpress.org/support/users/myironlung3/)
 * (@myironlung3)
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite/)
 * I have created a custom post type called “Products” (slug=”products”) and a custom
   taxonomy called “Product Categories” (slug=”product-categories”).
 * I want to include the product category in the URL for the single product pages.
   For example, it should like this:
 * [http://domain.com/products/shoes/nike-air-jordan](http://domain.com/products/shoes/nike-air-jordan)
 * I am exporting the code to my functions file and I see the rewrite argument where
   the product category should be added (see below). However, I don’t know how to
   query the product category here or if it is possible to do that within this argument.
 * `'rewrite' => array('slug' => 'products', 'with_front' => true),`
 * I’m thinking…
 * `'rewrite' => array('slug' => $productcategory, 'with_front' => true),`
 * $productcategory = ? (This is the part I can’t figure out.)
 * [http://wordpress.org/plugins/custom-post-type-ui/](http://wordpress.org/plugins/custom-post-type-ui/)

Viewing 1 replies (of 1 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [12 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite/#post-4325864)
 * Admittedly, I’m not all that sure either. I’m not very well versed with the rewrite
   api portion of things. Hopefully you’ve found an answer since then though, and
   I wish I was a better help.

Viewing 1 replies (of 1 total)

The topic ‘Custom Post Type Rewrite’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [12 years, 5 months ago](https://wordpress.org/support/topic/custom-post-type-rewrite/#post-4325864)
 * Status: resolved