[wp-hackers] wp_nav_menu too simplistic?

Otto otto at ottodestruct.com
Tue Apr 6 19:27:06 UTC 2010


On Tue, Apr 6, 2010 at 2:16 PM, John Bloch <jbloch at olympianetworks.com> wrote:
> Even without that pre-built functionality, there are still the normal hooks
> that you have when updating a page. Nobody said it's easy to code such a
> plugin; I just said that it was possible.

Yuck. Okay, so I consider hacky ways of doing things to be invalid.
Therefore, it is not possible. :)

There's no action hooks or filters or anything in the menu generation
system. Basically, the wp_setup_nav_menu_item builds the url and such,
then that gets passed to wp_get_nav_menu_item which builds the link,
and then it gets shoved into the output.

Short of hideous regexp and filtering that whole menu and such,
there's no way to insert stuff into the menu dynamically. All you can
do is recognize changes and then modify the menu (and probably break
it in the process, the ordering system is fragile as well).

A better solution would be to make the menu system not all so focused
on static links and use something more like widgets, which get called
to build their link (and which could then be static, if desired). Then
it'd be more configurable and more expandable.  Plus we wouldn't need
all this Woo code for Ajax and such, since a widget system already
exists and is in the core.

-Otto


More information about the wp-hackers mailing list