WordPress 4.4+ breaks Walker Extension

Your original solution was a hack, and no surprise it failed. In general never add methods/attributes to objects that you do not control their class and future development.

The right way is to create your own object to be passed to the walker. Pass to it the category object on construction and either populate fields is a similar way to the category object or write accesor functions for it (for full hacking points use _get() and _set() 😉 ). Design it good enough and your walker code will not have to change at all, only the initialization.

Leave a Comment