Skip to content

Instantly share code, notes, and snippets.

@conschneider
Created September 27, 2017 18:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save conschneider/f4ea9adc521d6caf54910728a3f26184 to your computer and use it in GitHub Desktop.
Save conschneider/f4ea9adc521d6caf54910728a3f26184 to your computer and use it in GitHub Desktop.
WordPress check if post has custom taxonomy
<?php
// use of function has_term( 'slug', 'taxonomy_name', $post->ID );
// taxonomy_name for example: Visibility
// slug for example: visible
// $post->ID = current post
$terms = has_term( 'intern', 'artikel_typ', $post->ID );
if($terms)
{
//do something
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment