• Resolved blindsquirrel

    (@blindsquirrel)


    For a custom post type I’m trying to display the terms checklist but I only want to display the ones that are “checked” or selected. In other words, I don’t want to display the entire list, just the selected items.

    The Codex states:
    descendants_and_self
    (boolean) Display only categories that apply to this post and their children or display all categories. The default is false (display all categories). Valid values:

    • 1 (True)
    • 0 (False) – Default

    I have not had any trouble getting the checklist to display. The correct boxes are checked but the problem is that the empty boxes are shown as well. If I enter a “descendants_and_self” parameter of 1 or true the checklist doesn’t display at all. Am I doing something wrong or is this a bug in the function for version 4.1?

    P.S. it would be really nice if this function had a “parent” parameter to display only child categories for a specified parent.

Viewing 2 replies - 1 through 2 (of 2 total)
  • I’m not sure if this is possible, but one thing to keep in mind is that if you DON’T display all (including unchecked) categories, you can never “choose” a category – or change a category for a Post that you may want to change the category for (for example if you selected the incorrect one when publishing the Post). And ALL posts could only be assigned to the default category.

    Maybe if you explained more about what you’re trying to accomplish, instead of how you’re trying to do it, some of the more experienced WP coders/developers can help you come up with a solution.

    Thread Starter blindsquirrel

    (@blindsquirrel)

    Thanks for the suggestion, I decided not to use this feature after all. The problem I am running into is a website that has hundreds of custom post categories. The built-in admin widget is hardly sufficient in this scenario so I was developing a new meta box to manage the categories better. I decided to go with a different method instead. Still confused by the “descendants_and_self” parameter though, the codex is pretty vague and it doesn’t seem to function as described.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘wp_terms_checklist display selected categories only’ is closed to new replies.