[wp-trac] [WordPress Trac] #14698: Adding custom menu items in a WP managed menu
WordPress Trac
wp-trac at lists.automattic.com
Thu Nov 18 14:55:48 UTC 2010
#14698: Adding custom menu items in a WP managed menu
-------------------------------+--------------------------------------------
Reporter: mackeyn@… | Owner:
Type: enhancement | Status: reopened
Priority: normal | Milestone:
Component: Menus | Version: 3.0.1
Severity: minor | Resolution:
Keywords: |
-------------------------------+--------------------------------------------
Changes (by mackeyn@…):
* status: closed => reopened
* resolution: invalid =>
Comment:
I agree that the following lines of code is a pretty nasty hack
{{{
// set db_id to negitive value to avoid collisions with posts with the
same ID
// This is needed due to the non-strict equality check in
classes.php
// line 932 in Walker::walk(). I would love to use a string for
the
// term ID's (something like 'term:4'), but "any string" == 0 will
// always return false.
$term->db_id = -1*$term->ID;
}}}
That doesn't change the fact that it's not possible to inject a mixture of
posts and categorizes into a menu without the risk of a collision in
db_id's. It doesn't really matter to me how this is fixed. In fact the
requirements on my project changed and we ended up using a custom post
type instead of a category. In my opinion, wp_setup_nav_menu_item()
should be able to prepare pages, posts, categories, menu_items, etc. to be
added to a menu. The way that it is now, if a page and a taxonomy term
have the same db_id, the one will override the other. If you really feel
strongly that this doesn't warrant a fix, please re-close it and I'll
leave it alone. Just trying to help.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/14698#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list