I am relatively new to wordpress development, I am trying to extend 'Walker_Category_Checklist' class found in /wp-admin/includes/class-walker-category-checklist.php to customize it for wp_terms_checklist() or wp_category_checklist() but when I try to require_once a link to my extended class in the child-theme function.php I get this error and site not loading!

x" Fatal error: Class 'Walker_Category_Checklist' not found in ..... "

Is it because of this class file in 'wp-admin/includes/' dir? if so then how to extend it ?

wordpress ver: 5.6 - php ver: 7.2

Thanks in advance Cheers Mo.


You can extend it, but the class definition and any code that uses it, can't run outside of the admin area.

Wrap your class in this conditional:

if ( is_admin() ) {

If you are trying to use this on the frontend or other non-Admin areas, do not do that.

Generally, classes WordPress uses should not be extended, walker classes and WP_Widget are the notable extensions.

Also, it's good practice to put classes in their own files.

  • thanks for your reply, unfortunately I can't extend this class because it's in wp-admin even it's just for building checkbox list menu!! I extended Walker class instate of it.
    – MoSaber
    Jan 26 at 7:18

I could not extend directly Walker_Category_Checklist I think because it's in wp-admin dir. even it's for "output an unordered list of category checkbox"!! similar classes to it etc. "Walker_Nav_Menu" existing in wp-include witch is should be the right place for the "Walker_Category_Checklist" I guess.. The answer that I found is going around by extending the parent class "Walker" to "my_Walker_Category_Checklist" then copy the code from "Walker_Category_Checklist" then do my customization on it, like that everything if working.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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