Hi guys,
I have a custom post type "product_info" with a custom taxo "vehicles".
Currently, I can filter posts by /product_info?vehicles=ford
Ideally, I'd like to have a pretty permalink like /product_info/vehicles/ford
Is this possible with custom posts & custom taxos?
John Cotton answers:
Add this to your functions.php file, and then re-save your permalinks (Settings > Permalinks)
function my_add_rewrite_rules( $rules ) {
$newrules = array();
$newrules['^product_info/vehicles/(.+?)$'] = 'index.php?vehicles=matches[1]';
return $newrules + $rules;
}
add_action('rewrite_rules_array', 'my_add_rewrite_rules');
Milan Petrovic answers:
Check out my plugin GD Custom Posts and Taxonomies Tools Pro, it supports custom rewrite rules, it supports intersection links (post type archive with one or more taxonomies for filtering) and other things you might find useful:
http://www.dev4press.com/gd-custom-posts-and-taxonomies-tools/
Tutorial with examples:
http://www.dev4press.com/2011/tutorials/plugins/gd-taxonomies-tools/enhanced-custom-post-types-url-rewriting/
Video:
http://www.dev4press.com/2011/tutorials/plugins/gd-taxonomies-tools/custom-permalinks-for-custom-post-types/
Luis Abarca answers:
In this way ??
http://dev.justoalblanco.com/product_info/vehicle/ford/
http://dev.justoalblanco.com/product_info/vehicle/ford/expedition-2011/
Try using this code:
http://pastebin.com/HB37tjaB