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
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.)
The topic ‘Custom Post Type Rewrite’ is closed to new replies.