[wp-trac] [WordPress Trac] #23805: wp_ajax_add_menu_item() closed to user-created menu item types

WordPress Trac noreply at wordpress.org
Sun Feb 16 02:32:23 UTC 2014


#23805: wp_ajax_add_menu_item() closed to user-created menu item types
--------------------------+------------------------------
 Reporter:  GaryJ         |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Menus         |     Version:
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |     Focuses:
--------------------------+------------------------------

Comment (by GregLone):

 I second that.

 I have a [plugin](http://wordpress.org/plugins/sf-archiver/) that builds a
 custom type, like @GaryJ. So far I couldn't find a way to avoid 2 php
 notices because of that problem (the variable `$_object` is not set).
 Another way would be to add a filter in the switch, in a `default:`
 statement. Perhaps something like that:

 {{{
     default :
         $_object = apply_filters( $menu_item_data['menu-item-type'] .
 '_menu_item_type', false, $menu_item_data );
     break;
 }

 if ( $_object ) {
     $_menu_item = wp_setup_nav_menu_item( $_object );

     // Restore the missing menu item properties
     $menu_item_data['menu-item-description'] = $_menu_item->description;
 }
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23805#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list