Skip to content

Instantly share code, notes, and snippets.

@sitebuilderone
Last active December 3, 2018 18:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sitebuilderone/b8e2b7a02903ed1677ea9532e99248b8 to your computer and use it in GitHub Desktop.
Save sitebuilderone/b8e2b7a02903ed1677ea9532e99248b8 to your computer and use it in GitHub Desktop.
Custom post types (CPT) snippets
// display category terms for CPT3
$terms = get_the_terms( $post->ID , 'website_tools_category' );
foreach ( $terms as $term ) {
$term_link = get_term_link( $term, 'website_tools_category' );
if( is_wp_error( $term_link ) )
continue;
echo '<a href="' . $term_link . '">' . $term->name . '</a>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment