How to use WordPress Rewrite API?
Complete tutorial – Coming Soon function custom_rewrite_basic() { add_rewrite_rule(‘^products/([^/]*)/reviews/([^/]*)’, ‘index.php?product-slug=$matches[1]&product-child=reviews&product-comment-key=$matches[2]’, ‘top’); } add_action(‘init’, ‘custom_rewrite_basic’); function prefix_register_query_var( $vars ) { $vars[] = ‘product-slug’; $vars[] = ‘product-child’; $vars[] = ‘product-comment-key’; return $vars; } add_filter( ‘query_vars’, ‘prefix_register_query_var’ ); function prefix_url_rewrite_templates() { if ( get_query_var( ‘product-slug’ ) && get_query_var( ‘product-child’ ) == ‘reviews’ && get_query_var( ‘product-comment-key’ )) { $product_slug […]
Read more