[wp-trac] [WordPress Trac] #32700: Allow media attachments in nav menus

WordPress Trac noreply at wordpress.org
Wed Jul 12 16:02:23 UTC 2017


#32700: Allow media attachments in nav menus
-------------------------------------------------+-------------------------
 Reporter:  bobbingwide                          |       Owner:
     Type:  enhancement                          |      Status:  new
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Menus                                |  Review
 Severity:  normal                               |     Version:
 Keywords:  has-patch dev-feedback needs-unit-   |  Resolution:
  tests                                          |     Focuses:
-------------------------------------------------+-------------------------

Comment (by Rob_Huska):

 Replying to [comment:3 bobbingwide]:
 > I've uploaded a patch file that changes _wp_nav_menu_meta_box_object().
 >
 > In order to test it you need to set show_in_nav_menus to true against
 the attachment post type object, in response to "init".
 >
 > {{{
 > $post_type_object = get_post_type_object( "attachment" );
 > $post_type_object->show_in_nav_menus = true;
 > }}}
 >
 > You also need to create some attachments.
 >
 > I'm not sure where to develop a unit test for this :-)
 >

 Ok, so I have been able to make the Media show on the nav menu page by
 doing

 {{{
 add_action( 'init', 'add_attachments_to_nav_menu' );
 function add_attachments_to_nav_menu() {
         $post_type_object = get_post_type_object( "attachment" );
         $post_type_object->show_in_nav_menus = true;
 }
 }}}

 But how do I update the  {{{ _wp_nav_menu_meta_box_object() }}} for
 attachments to be {{{ post_status->"inherit" }}} so that media files show
 up?

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


More information about the wp-trac mailing list