Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

jalefkowit on "Overriding display_element in Walker class?"

$
0
0

In my process of learning how to work with the Walker class, I've come across a lot of online guides (including in generally high-quality venues like these forums and StackOverflow) that encourage overriding its display_element method. (Example, example, example, example.)

However, in the Codex's reference for the Walker class, when you look up the display_element method, it says (in bold, no less!):

This method should be considered private and should not be called directly.

I generally steer away hard from solutions that require making use of private/undocumented APIs, for the simple reason that such APIs tend to change with little or no warning, which can ruin your whole day. But I have yet to find any examples in this case of someone suggesting overriding this method and anyone responding that doing so is a terrible idea, despite what seems to be a very clear warning in the Codex.

So: I wanted to check in with the community to see if this is a case of a bad practice that's just gotten accepted by people, or if it's a case of something that used to be bad not being so bad anymore and the Codex just being out of sync with the Walker class as it currently works/exists.

Any thoughts?


Viewing all articles
Browse latest Browse all 8245

Trending Articles