[wp-hackers] Unique slugs (title form urls) vor area codes in different custom post types?

F. Oliver Bockelmann (fob marketing) fob at fob-marketing.de
Wed Apr 25 10:43:56 UTC 2012


I do not know if it is a bug or a feature. Can anybody help?

I registered two custom post types. Both should make use of their own 
taxonomies. One of these taxonomies is a section where administrators 
can fill in area codes to choose from when it comes to a post. So we 
added all the numbers two times, one code per post type. Each of the 
terms (area code numbers) can have a number, a description and a title 
form to be used in urls.

Everything seemed to work like a charme - but now we recognized that if 
we change a url for one of those area codes we automatically update this 
area code within the other custom post type. This lets us run into 
trouble. The issue seems to be that in most of the cases both custom 
post types use the same "tag id". Only where this is not the case it 
works like expected.

Taxonomies are registered like this:

"

|register_taxonomy('nachhilfe-nach-plz', array('fob_nachhilfeorte'),
	array( 'public' =>  true, 'hierarchical' =>  true, 'query_var' =>  true,
	'rewrite' =>  array('slug' =>  'abacus-nachhilfe-orte/nachhilfe-nach-postleitzahl', 'with_front' =>  false),
	'show_in_nav_menus' =>  true, 'labels' =>  array('name' =>  __( 'Postleitzahlen' ), 'singular_name' =>  __( 'Postleitzahl')) ) );

  register_taxonomy('schulen-nach-plz', array('fob_schulen'),
	array( 'public' =>  true, 'hierarchical' =>  true, 'query_var' =>  true,
	'rewrite' =>  array('slug' =>  'abacus-nachhilfe-schulen/schulen-nach-postleitzahl', 'with_front' =>  false),
	'show_in_nav_menus' =>  true, 'labels' =>  array('name' =>  __( 'Postleitzahlen' ), 'singular_name' =>  __( 'Postleitzahl')) ) );

"
|

We want to have unique slugs for area codes because one is meant for 
schools and the other one is meant for educational trainings. Let me 
give you an example where it works: 22337 
<http://www.nachhilfe-in-hamburg.de/abacus-nachhilfe-schulen/schulen-nach-postleitzahl/nachhilfe-schulen-22337-hamburg/> 
vs. 22337 
<http://www.nachhilfe-in-hamburg.de/abacus-nachhilfe-orte/nachhilfe-nach-postleitzahl/nachhilfe-22337-hamburg/> 
and where it does NOT work as expected: 22297 
<http://www.nachhilfe-in-hamburg.de/abacus-nachhilfe-schulen/schulen-nach-postleitzahl/nachhilfe-22297-hamburg/> 
vs. 22297 
<http://www.nachhilfe-in-hamburg.de/abacus-nachhilfe-orte/nachhilfe-nach-postleitzahl/nachhilfe-22297-hamburg/> 
(because one slug overwrites the other one here).

In most of the cases it does not work as expected. May be there is a 
trick for better separation of these entries to make them unique on both 
sides?

More information can be found on themehybrid.com (unfortunately for 
members only):
http://themehybrid.com/support/topic/updating-taxonomy-urls-without-overwriting-slugs-of-different-post-types#post-69566 


Thanks and best regards
Oliver


-- 
Mit besten Grüßen
F. Oliver Bockelmann

--
fob marketing e.K. - Bilser Str. 36 - 22297 Hamburg
Performance Marketing, IT- und Internet Consulting
(Entwicklung, SEO, SEA, SEM)

Telefon: 0 40 - 5 11 51 44
Telefax: 0 40 - 51 43 08 50
Email: mailto:fob at fob-marketing.de
URL:   http://www.fob-marketing.de/
Blog:  http://www.fob-marketing.de/marketing-seo-blog/

Inhaber: Dipl.-Betriebswirt F. Oliver Bockelmann
UST-ID-Nummer: DE225254550
Handelsregister Hamburg: HRA 98018

XING:      http://www.xing.com/profile/FOliver_Bockelmann
Twitter:   http://twitter.com/Markenseologe
LinkedIn:  http://de.linkedin.com/in/oliverbockelmann
Facebook:  http://de-de.facebook.com/oliver.bockelmann



More information about the wp-hackers mailing list