WordPress.org

Make WordPress Core

Opened 10 years ago

Last modified 5 months ago

#12945 accepted defect (bug)

Constrain wp_page_menu()

Reported by: technosailor Owned by: technosailor
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords: has-patch dev-feedback
Focuses: Cc:
PR Number:

Description

The wp_page_menu() function is the default callback for wp_nav_menu(). IOW, when a user is not using the new menu system, it defaults to this function. While that is good, any number of pages over, say 10, will make a theme puke in many cases.

As a workaround, I suggest we make a default of wp_page_menu() to exclude all pages() except home. It's a stupid idea, I think, but something needs to be done to make this manageable so I'm looking for feedback.

The Pro of taking this approach is that it encourages customization of menus via the WP menu system. It also does not lock theme devs into a particular approach because this stuff can be overidden via arguments and filters.

The con is that the default callback becomes pretty benign and useless. Almost pointless.

Ideas?

Attachments (6)

12945.diff (2.1 KB) - added by technosailor 9 years ago.
This should be considered for 3.1, not 3.0, as it modifies the get_pages() function and adds a new include_full argument where, if true, returns an array of postdata and if false returns an array of IDs
12945-2.diff (2.1 KB) - added by technosailor 9 years ago.
12945-3.diff (2.1 KB) - added by technosailor 9 years ago.
Follows the style of get_terms()
12945-4.diff (2.0 KB) - added by technosailor 9 years ago.
12945-5.diff (2.2 KB) - added by technosailor 9 years ago.
Saves a query if a user passes in an exclude array
12945.2.diff (1.2 KB) - added by technosailor 6 years ago.
Still a less than idea solution. Would be better if I had access to postnot_in, but... refreshed patch more cleanly fixes this issue. wp_page_menu() now includes a home link only, and respects if a user has designated a page for the front page. Filters remain in place for plugins to modify.

Download all attachments as: .zip

Change History (18)

#1 @mrmist
10 years ago

+1 to limiting by default in some way.

#2 @demetris
10 years ago

  • Cc dkikizas@… added

#3 @technosailor
9 years ago

  • Milestone changed from Unassigned to Future Release
  • Owner set to technosailor
  • Status changed from new to accepted
  • Version 3.0 deleted

#4 @technosailor
9 years ago

  • Cc technosailor added

@technosailor
9 years ago

This should be considered for 3.1, not 3.0, as it modifies the get_pages() function and adds a new include_full argument where, if true, returns an array of postdata and if false returns an array of IDs

@technosailor
9 years ago

@technosailor
9 years ago

Follows the style of get_terms()

@technosailor
9 years ago

@technosailor
9 years ago

Saves a query if a user passes in an exclude array

#5 @iseulde
6 years ago

  • Component changed from General to Menus

#6 @helen
6 years ago

Still want this?

#7 @technosailor
6 years ago

Yes, but I want it done a different way. Standby for a patch

@technosailor
6 years ago

Still a less than idea solution. Would be better if I had access to postnot_in, but... refreshed patch more cleanly fixes this issue. wp_page_menu() now includes a home link only, and respects if a user has designated a page for the front page. Filters remain in place for plugins to modify.

#8 @technosailor
6 years ago

  • Keywords has-patch added

#9 @SergeyBiryukov
6 years ago

  • Keywords dev-feedback added; needs-feedback removed

#10 @SergeyBiryukov
6 years ago

#8298 was marked as a duplicate.

This ticket was mentioned in Slack in #meta by chriscct7. View the logs.


4 years ago

Note: See TracTickets for help on using tickets.