#33124 closed defect (bug) (worksforme)
Unpublished posts in menu customizer
Reported by: | greenshady | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.3 |
Component: | Customize | Keywords: | |
Focuses: | Cc: |
Description
I have a post type that utilizes various statuses other than the publish
post status, so it would naturally show "No items" for adding to the menu without that status. Normally, you'd filter nav_menu_meta_box_object
to get the correct posts to appear on the menu management admin screen. However, filters on this don't seem to work when managing menus in the customizer.
Here's what I've been using:
add_filter( 'nav_menu_meta_box_object', 'my_nav_menu_meta_box_object' ); function my_nav_menu_meta_box_object( $object ) { if ( isset( $object->name ) && 'post_type_name' === $object->name ) { $statuses = array( 'open', 'close', 'private', 'hidden' ); $object->_default_query = wp_parse_args( array( 'post_status' => $statuses ), $object->_default_query ); } return $object; }
As far as I can tell, there are no new hooks directly related to menus in the customizer for this.
Marking this under the "Customize" component. Might need to be the "Menus" component. Not sure.
Change History (3)
Note: See
TracTickets for help on using
tickets.
@greenshady: I think what you're looking for may be in #32708? The
customize_nav_menu_available_item_types
andcustomize_nav_menu_available_items
filters allow for additional types to be made available for adding to a menu, and for which items are available in each type.