Custom permalink based on custom post type fields

Look at the filter for rewrite_rules_array and add a re-write rule to re-write /products/category-name/sub-category-name/product-name to index.php?pagename=product-name. You might need to grab the category-name and sub-category-name too if your product-names are not unique.

Then add a query var for product-name using the query_vars filter.

Once you’ve done that in your new post type template you can just access the product-name query var (and the others) using get_query_var. And display the correct record.

Without coding the answer for you that’s and outline of how I’ve done exactly what you’re trying to do.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)