WordPress.org

Ready to get started?Download WordPress

Forums

Check whether post is in a list of categories (2 posts)

  1. tkhobbes
    Member
    Posted 6 years ago #

    Hi all

    I had this line of code in a plugin I am developing:

    if in_category($the_categories) { ... }

    This works fine as long as $the_categories is something like "7" or "1001". But as soon as it is a list of categories, like "7,1001", it does not work any more.

    So, how do I achieve this? Note that I cannot use

    if (in_category($category1) || in_category($category2) )

    ...because I want to build a widget where the user can input a list of categories like "7,1001" (which then is used for the conditional tag.

    Thanks!

  2. tkhobbes
    Member
    Posted 6 years ago #

    No one? (*bump*)

Topic Closed

This topic has been closed to new replies.

About this Topic