Get a WordPress Category ID

I struggled bus’d pretty hard on this one today. I needed to ignore the “featured” category in a loop, and to do so, WP_Query() requires the category ID. Luckily, I found get_term_by();

https://gist.github.com/gregrickaby/e3b3e7982f6a4c42f3a8c27b4e18bcda

 

About Greg Rickaby

Director of Engineering @WebDevStudios / Author & Tech Editor @ForDummies / @WordPress Contributor / @gatsbyjs Maintainer

1 Comment

  1. Guigo on July 2, 2016 at 11:35 am

    Thank you!

Leave a Comment