WordPress.org

Support

Support » How-To and Troubleshooting » Display only related subcategories of a Post using wp_list_cats?

Display only related subcategories of a Post using wp_list_cats?

  • I’m looking for functionality that combines the_category() and wp_list_cats(‘child_of=123’)

    I want to be able to list subcategories of a parent category that are only related to the post that a user is viewing.

    Currently, wp_list_cats(‘child_of=123’) displays all subcategories of the parent category (123) regardless of whether or not the current post is related to it. I thought there may be a flag to only return related subcategories but that does not exist.

    the_category() returns everything related to the post but I want to be able to limit what subcategories are displayed by specifying the parent category id, hence (child_of).

    Is there a way of accomplishing this, or is a hack/plug-in required?

    Thanks,

    nakiayoung

  • The topic ‘Display only related subcategories of a Post using wp_list_cats?’ is closed to new replies.