Created
January 29, 2018 23:25
-
-
Save alimoshen/7091df992113978a8bfdadcf0e3bc3fc to your computer and use it in GitHub Desktop.
Get all terms
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function filter_post_type_link($link, $post) | |
{ | |
if ($post->post_type != 'expertise') | |
return $link; | |
if ($cats = get_the_terms($post->ID, 'expertise_type')) | |
{ | |
$link = str_replace('%expertise_type%', get_taxonomy_parents(array_pop($cats)->term_id, 'expertise_type', false, '/', true), $link); // see custom function defined below | |
} | |
return $link; | |
} | |
add_filter('post_type_link', 'filter_post_type_link', 10, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment