What is wp_insert_term “alias_of” arg for?

In the Code Reference it says:

‘alias_of’

(string) Slug of the term to make this term an alias of. Default empty string. Accepts a term slug.

This makes a term an alias of another term. Using your example this is how you would use it:

wp_insert_term( 'e', 'tax', array( 'alias_of' => 'a' ) );

This would create a new term e in the tax taxonomy without its own slug, and posts in e would also show up under the a slug.

Leave a Comment