I have a product registration page with a form in which I use wp_category_checklist() to make my users select categories. This works great only, I just today noticed that only admin's can use the checklist! For normal users the whole category list doesn't even show up! Is there any workaround for this? I've googled but couldn't find it.

What I mean with "it doesn't show up" is that every element below the wp_category_checklist in the DOM gets deleted.

E.g. If I have

<body><? wp_category_checklist(); ?>
<div> one million div's here</div>

It won't show me anything on the page, the <body> would be blank.

  • When you say it doesn't even show up, what shows in it's place in the source? Are the checkboxes there but with a disabled attribute?
    – majick
    Commented Mar 2, 2016 at 5:14
  • Everything in the DOM below the function gets deleted. I made an example in my updated question above.
    – mesqueeb
    Commented Mar 2, 2016 at 7:29
  • ok, what is the context of the page? this is typically an admin function, so if it is not in the admin, then the class and function will probably not exist and you are getting a fatal error because of it. you can check your PHP error log to confirm this... try adding require_once(ABSPATH.'wp-admin/includes/template.php');
    – majick
    Commented Mar 2, 2016 at 8:41
  • Yeah I need to use it on a front end form where the user can post. and choose categories from the checklist. That's why I want to make it work for non-admin users as well!
    – mesqueeb
    Commented Mar 2, 2016 at 9:12

1 Answer 1


If you want to use the wp_category_checklist on pages that also non-admin users access. You have to include the following php:

<? require_once(ABSPATH.'wp-admin/includes/template.php'); ?>

Credit to Majick!

  • sweet, glad it worked..! hey one note, just make sure there are no inputs with the disable attribute for non-admin users, I did notice this function checks the assign_terms capability for the taxonomy and passes to the walker class... hopefully this is not happening to you but if it is you may need to do some more work on it.
    – majick
    Commented Mar 2, 2016 at 11:48
  • I'm not sure what you mean... =S I'm using it now just to create the HTML checklist, and through a custom form I change the categories for the posts like this: $catarray = $_POST['post_category']; and wp_set_post_terms($post_id, $catarray, 'category'); Do you think that's an OK method? I'm not so knowledgable about walkers yet though! haha.
    – mesqueeb
    Commented Mar 3, 2016 at 0:19
  • The method is fine if it is all working, no problem..! I just noticed when trying to work out what was going on in the original question that if the user does not have the correct permissions to $tax->cap->assign_terms then the checkboxes will be disabled (this is actually done in the walker class.) The codex is sketchy on this permission (not even mentioned on the capabilities page), but since this capability is not set by default for the category taxonomy, it should be fine. For custom taxonomies where this capability has been set, it may be a problem. Call this a footnote then ;-)
    – majick
    Commented Mar 4, 2016 at 0:49
  • Thanks mate ! I need to study a bit on Walkers! If you do have some spare time, could you have a look at this other post I'm really banging my head on lately. You've helped me so much! Thanks a lot!
    – mesqueeb
    Commented Mar 4, 2016 at 0:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.