gdtt_get_advanced_intersection_link($post_type, $terms = array())
- $post_types: custom post type name.
- $terms: terms to include in link: name, id or object. This must be associated array, where key is taxonomy name.
Get URL for the archive intersection of post type and taxonomy terms. Make sure that taxonomy belongs to specified post type, that you have advanced intersections enabled and permalink for intersections set. Terms array has taxonomies for keys.
If you have post type named ‘movie’, taxonomies named ‘genre’ (we will use term ‘drama’) and ‘director’ (we will use ‘david-lynch’). Also, we have permalinks structure set to ‘%genre%/%director%’ to get link for it use the function:
[php]$url = gdtt_get_advanced_intersection_link(
‘genre’ => ‘drama’,
‘director’ => ‘david-lynch’
You will get URL like this: http://www.example.com/movie/drama/david-lynch/
If the permalinks are disabled in WordPress, URL will be this: http://www.example.com/?post_type=movie&genre=drama&director=david-lynch