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

Add db_manufacturer taxonomy to post type URL WordPress

I have a taxonomy for manufacturers of guitar effects pedals:

register_taxonomy("db_manufacturers", array("db_pedals"), array("hierarchical" => true, "label" => "Manufacturers", "singular_label" => "Manufacturer", "rewrite" => array('slug' => 'pedals')));


I have a custom post type for guitar effects pedals:


add_action('init', 'db_pedals_register');

function db_pedals_register() {

$labels = array(
'name' => _x('Pedals', 'post type general name'),
'singular_name' => _x('Pedal', 'post type singular name'),
'add_new' => _x('Add Pedal', 'pedal'),
'add_new_item' => __('Add Pedal'),
'edit_item' => __('Edit Pedal'),
'new_item' => __('New Pedal'),
'view_item' => __('View Pedal'),
'search_items' => __('Search Pedals'),
'not_found' => __('Nothing found'),
'not_found_in_trash' => __('Nothing found in Trash'),
'parent_item_colon' => ''
);

$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'query_var' => true,
'rewrite' => array('hierarchical' => 'true', 'slug' => 'pedal', 'with_front' => 'true'),
'capability_type' => 'post',
'hierarchical' => false,
'menu_position' => 105,
'supports' => array('title','editor', 'thumbnail', 'excerpt', 'custom-fields', 'comments')
);

register_post_type( 'db_pedals' , $args );


}


How do I get the db_manufacturers taxonomy term in the permalink for a post in the db_pedals post type, so that the resulting URL is mywebsite.com/pedals/%db_manufacturer%/%postname%

Answers (2)

2011-07-22

Julio Potier answers:

Hello

Install this plugin (http://wordpress.org/extend/plugins/custom-post-permalinks/) and go to "permalink" settings.

Done !


Dan Davies comments:

<blockquote>WARNING: This plugin is no longer supported or maintained by its author! Use at your own risk!</blockquote>

I think I'll pass!


Julio Potier comments:

I use it and got no problem.
ps : i'm web security consultant ;)


Dan Davies comments:

I'd rather add something to my code rather than rely on the continued functionality of a plugin. If there are no other options then I'll use this. Thanks :)

2011-07-22

Romel Apuya answers:

please read this.
[[LINK href="http://codex.wordpress.org/Function_Reference/get_the_term_list"]]
Gettermlist
[[/LINK]]


Dan Davies comments:

I don't see how that helps?


Romel Apuya comments:

really?

then maybe you should read this article on setting custom taxonomy to your [[LINK href="http://shibashake.com/wordpress-theme/add-custom-taxonomy-tags-to-your-wordpress-permalinks"]]permalink[[/LINK]]