I’ve created 2 custom posts (post types), and I’m trying to make the urls right.
custom page 1 "products" contains products
custom page 2 "productlist" contains lists of products picked from the products.
When you create a productlist you can pick products from custom page 1.
The relationship works fine (using ACF pro plugin) and products are showing up right on all pages, It's just wrong urls.
FILES
archive-productlist.php
single-productlist.php
single-product.php
current url stucture:
example.com/productlist/some-list
example.com/product/some-product
should be:
example.com/produclist/some-list/some-product
index.php?post_type=productlist&productlist=some-list-clicked&product=some-product-clicked
The url is good until the link to the product is clicked and goes back to example.com/product/some-product
functions.php
product page should be something like:
'has_archive' => 'productlist',
‘rewrite’ => array(‘slug’=>’productlist/%thelist%/product’, ‘with_front’=> false),
productlist page is currently:
‘rewrite’ => array(‘slug’=>’productlist’,’with_front’=> false),
I've given up after days of head-scratching and searching, so can anyone explain how to fix this?