[wp-trac] [WordPress Trac] #12566: Menu editor link (URL) disappears (and other menu weirdness)

WordPress Trac wp-trac at lists.automattic.com
Sun Mar 14 23:58:37 UTC 2010


#12566: Menu editor link (URL) disappears (and other menu weirdness)
--------------------------+-------------------------------------------------
 Reporter:  Dickie        |        Owner:            
     Type:  defect (bug)  |       Status:  reopened  
 Priority:  high          |    Milestone:  Unassigned
Component:  Menus         |      Version:  3.0       
 Severity:  major         |   Resolution:            
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by mikeschinkel):

  * component:  General => Menus
  * severity:  normal => major


Comment:

 I've been spending the past 4+ hours chasing my tail trying to solve the
 problem of where a menu item for a Page doesn't get a correct URL.  I'm
 running into several things.  First, somehow menu_type in postmeta gets
 'Page' instead of 'page' and thus $type=='page' does not work as it
 should.  I've tried to track down the source of this and it appears that
 line 228 on /wp-includes/nav-menu.php sets:
 {{{
 $menu_item->append = _x('Page', 'menu nav item type');
 }}}
 I don't at all understand the use for _x() here because it seems that
 $menu_item->append is only ever used on line 201 of the same file for the
 item code (why does something that is used internally need to be
 translated?):
 {{{
 $item .= '<input type="hidden" class="item-type" value="'. esc_attr(
 $menu_item->append ) .'" />';
 }}}
 IF that's it you can also find similar on lines 244 and 251, respectively:
 {{{
 $menu_item->append = _x('Category', 'menu nav item type');
 $menu_item->append = _x('Custom', 'menu nav item type');
 }}}
 However I also found there were errors in the .js files.  Most important I
 found was that item-dbid is not moved over from the queue to the list of
 menus.  I found that wp_update_queue() doesn't get the value for dbid and
 the append to jQuery('#queue') doesn't have it included. (Question:
 wouldn't it be better for wp_update_queue() to accept an object rather
 than ~10 named parameters?  As is it is very fragile for future
 modifications.)

 BTW, in (at least) two places there are trailing commas in object
 definition syntax PHP style that don't work for JS:
 {{{
 -- Line 114 - /wp-admin/js/nav-menu-default-items.dev.js
 -- Line 254 - /wp-admin/js/nav-menu-dynamic-functions.dev.js
 }}}

 Of course when I "fix" the problems in the .js files they menu item stops
 saving so I give up. I've now spent 4 hours trying to trace this down and
 I guess I just don't understand the logic behind it enough to fix it. (I
 tend to like code that is more encapsulated than this so I am having a
 hard time following it.)

 Beyond that you find that line 128 in /wp-admin/nav-menus.php produces an
 "undefined" object_id for a "Page" type:
 {{{
 $object_id = isset( $_POST['item-postmenu'.$k] )? $_POST['item-
 postmenu'.$k] : 0;
 }}}

 I am just mentally exhausted because I really need to be doing something
 else today (which this bug was keeping me from doing) and I can't focus on
 it any more today.  I hope this helps whoever wrote the menus. I could
 really use this getting fixed sooner than later. :-)

 Thanks in advance.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/12566#comment:13>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list