Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Need to create archive pages for all combinations of product attribute "collection" and product tags WordPress

  • SOLVED

Woocommerce--
Combine product attribute "collection" and product-tags in archives

Essentially create "pretty permalinks" for the current URL setup.

Current URL setup
https://******.com/product-tag/shower-curtain/?pa_collection=florida-east

Desired url setup
https://******.com/product-tag/shower-curtain/pa_collection/florida-east



Figured this out on my own

function custom_rewrite( $wp_rewrite ) {

$feed_rules = array(
'collection/(.+)/product-tag/(.+)' => 'index.php?product_tag='. $wp_rewrite->preg_index(2).'&pa_collection='. $wp_rewrite->preg_index(1)

);

$wp_rewrite->rules = $feed_rules + $wp_rewrite->rules;
}
// refresh/flush permalinks in the dashboard if this is changed in any way
add_filter( 'generate_rewrite_rules', 'custom_rewrite' );



Now how can I add the new pages to the sitemap?

Answers (1)

2019-03-16

Arnav Joy answers:

Can you show your live site url?


Sspro comments:

I can provide via Skype, I sent you a message


Sspro comments:

Arnav, did you receive my message on Skype?