WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#13447 closed task (blessed) (fixed)

Allow new pages to be assigned to a menu

Reported by: nacin Owned by: nacin
Milestone: 3.0 Priority: normal
Severity: normal Version:
Component: Menus Keywords: needs-patch
Focuses: Cc:

Description


Attachments (2)

auto_add_pages.diff (3.8 KB) - added by nacin 5 years ago.
auto-add-publish-bottom.diff (2.3 KB) - added by nacin 5 years ago.
Add post_status to wp_update_nav_menu_item, allowing us to directly publish a new menu item. Also, check for draft menu items too when deciding menu order.

Download all attachments as: .zip

Change History (15)

comment:1 @filosofo5 years ago

Could you elaborate?

comment:2 @nacin5 years ago

(In [14738]) Rename wp_save_nav_menu_item to wp_save_nav_menu_items. Though it could handle one item, it expects a mess of post data containing an array of menu items. see #13447.

comment:3 @ryan5 years ago

Add an "Automatically add new pages to this menu" checkbox to each menu tab. When new pages are created, they are added to the end of any menu that has this checked. Also considered was having a dropdown or list of menus in the edit page form, but since adding new pages to a menu is a one time action rather than a state the UX for that would be cumbersome.

comment:4 @nacin5 years ago

  • Owner changed from nacin/koopersmith to nacin
  • Status changed from new to accepted

Checkbox is done on my local install. Just need to get the right callback in place on the publish_page hook.

@nacin5 years ago

comment:5 @nacin5 years ago

  • Keywords has-patch added

comment:6 @nacin5 years ago

(In [14878]) Allow pages to be added automattically to menus. see #13447.

comment:7 @nacin5 years ago

I'm finding that this reveals a bug (I think) in automatic positioning handled in wp_update_nav_menu_item, but we can iterate. (It adds them to the bottom, but above ones added previously through auto-add.)

comment:8 @nacin5 years ago

  • Keywords needs-patch added; has-patch removed

We're also not removing old menus from the auto_add list. We can do that either on save or on the publish hook by doing a get_objects_in_term and intersecting them.

comment:9 @nacin5 years ago

(In [14934]) Don't store nonexistent (deleted) menus in the auto-add option. see #13447.

@nacin5 years ago

Add post_status to wp_update_nav_menu_item, allowing us to directly publish a new menu item. Also, check for draft menu items too when deciding menu order.

comment:10 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [14937]) Ensure auto-added pages are both published and sent to the end of the menu. Tiny enhancement and optimization to wp_update_nav_menu_item come with it. fixes #13447.

comment:11 @nacin5 years ago

Thanks to filosofo for helping me review that.

We're going to handle UX for this in #13525, where discussion has already started on the exact placement of the checkbox added here. Thus, resolved as fixed.

comment:12 @nacin5 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

Forgot about post_parent.

comment:13 @nacin5 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed

(In [15111]) Ensure we're only auto-adding root pages to menus. fixes #13447.

Note: See TracTickets for help on using tickets.