I currently put my hands into WP taxonomy and terms to find solutions for my project.
I knew that it's not possible to have same terms slug when creating a term with wp_insert_term
in one Custom Taxonomy and between different Custom Taxonomies, but i would like to have different terms linked to the same url (so slugs are involved in it) and get all the related posts to these different terms.
Say a custom Taxonomy 'tax' and the following terms in it :
a (slug : a)
--b (slug : b)
-c (slug : c)
---d (slug : d)
I can access the different tax term with the following links :
/tax/a
/tax/b
/tax/c
/tax/d
If i want to insert a term with wp_insert_term('e','tax',array(slug=>'a')
, WP will modify the slug to 'a1' because slugs should be unique...
So, seems impossible to redirect different terms to the same slug/url and get all the custom posts from 'a' and 'e'.
And what about alias_of
argument ? Can't find any full documentation about it . Wasn't it precisely for that kind of issue ?
I've inserted several terms with that kind of code : wp_insert_term('e','tax',array(slug=>'e','alias_of'=>'a')
but it doesn't change anything, WP creates different unique slugs for all my entries and doesn't care about alias_of
.
Is Anybody here can clarify this or have a solution ?
thanks a lot !
EDIT
Seems to be related to term_group
, a feature that isn't really yet supported by WP. There is a term_group
field in wp_terms database . The value of this field is set on term creation wp_insert_term($name,$taxonomy,array('alias_of' => $slug)
and retrieve when get a term with (for ex get_term_by()->term_group
function).
There should be a way to query this but with the terms metas
support, i don't really see the interest ...
alias_of
implementation in thewp_insert_term()
andwp_update_term()
functions so I would think that this is still only half baked featured in the core.alias_of
announce what we will be able to do in future, but when :)