WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 4 years ago

Last modified 4 years ago

#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:
PR Number:

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)

#1 @westonruter
5 years ago

  • Keywords reporter-feedback added

@greenshady: I think what you're looking for may be in #32708? The customize_nav_menu_available_item_types and customize_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.

#2 @greenshady
4 years ago

  • Keywords reporter-feedback removed
  • Resolution set to worksforme
  • Status changed from new to closed

Yep, that's a major search #fail on my part in both the code and here in Trac. :)

#3 @netweb
4 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.