Skip to content

Instantly share code, notes, and snippets.

@billerickson
Created May 9, 2013 15:48
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save billerickson/5548314 to your computer and use it in GitHub Desktop.
Save billerickson/5548314 to your computer and use it in GitHub Desktop.
Example of wp_list_pluck().
<?php
$tags = get_the_terms( get_the_ID(), 'post_tag' );
$tags = wp_list_pluck( $tags, 'slug' );
if( in_array( 'freebies', $tags ) )
echo 'This is a freebie!';
// More info: http://codex.wordpress.org/Function_Reference/wp_list_pluck
@superphly
Copy link

So handy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment