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

WordPress Trac noreply at wordpress.org
Thu Jun 18 10:00:23 UTC 2015


#32700: Allow media attachments in nav menus
-------------------------+-----------------------------
 Reporter:  bobbingwide  |      Owner:
     Type:  enhancement  |     Status:  new
 Priority:  normal       |  Milestone:  Awaiting Review
Component:  Menus        |    Version:  trunk
 Severity:  normal       |   Keywords:
  Focuses:               |
-------------------------+-----------------------------
 I have a requirement to include Media items directly into a menu.
 Choosing the menu item will display the attachment page.

 Currently, this is not possible, for two reasons.

 By default post_type `attachment` has `show_in_nav_menus` set to false.

 If set true, then the Media metabox is displayed in `wp-admin/nav-
 menus.php`, but with "No items".

 This is due to _wp_nav_menu_meta_box_object() setting the default query to
 "post_status" = "publish".

 Were the default query for attachment set to "post_status" = "inherit"
 then the Media items would be listed.

 This would allow media items to be easily added to menus.
 {{{
                 } elseif ( 'attachment' == $object->name ) {
                   //

                         $object->_default_query = array(
                                 'post_status' => 'inherit',
                         );
 }}}

 === Current workaround ===

 I can very easily programmatically set `show_in_nav_menus`,
 I can also implement the `nav_menu_meta_box_object` filter
 to update the value for "post_status" as above.


 But it would be a lot easier if the logic in the filter was in core.

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


More information about the wp-trac mailing list