[wp-trac] [WordPress Trac] #13822: Menu items that get unpublished still appear

WordPress Trac wp-trac at lists.automattic.com
Sun Jun 13 05:19:49 UTC 2010


#13822: Menu items that get unpublished still appear
-----------------------------+----------------------------------------------
 Reporter:  nacin            |        Owner:  filosofo
     Type:  defect (bug)     |       Status:  reopened
 Priority:  highest omg bbq  |    Milestone:  3.0     
Component:  Menus            |      Version:  3.0     
 Severity:  major            |   Resolution:          
 Keywords:  dev-feedback     |  
-----------------------------+----------------------------------------------
Changes (by nacin):

  * keywords:  has-patch => dev-feedback
  * priority:  normal => highest omg bbq
  * status:  closed => reopened
  * resolution:  fixed =>


Comment:

 I'm seeing some issues with [15219].

 Listening for status changes is not very effective, as you can't easily
 account for all options.

 The commit does not account for pending, private, or scheduled posts, only
 draft posts. Additionally, the menu item is only triggered back to publish
 again when it goes straight from draft to publish. It might very well pass
 through pending or scheduled on the way to publish.

 I liked wpmuguru's take, though not the patch, and had tried to patch this
 in wp_setup_nav_menu_item() because we pull the post object and could
 easily check if the post status is not "publish," and then exclude it from
 the menu. Unfortunately, the way we call wp_setup_nav_menu_item() (through
 array_map) means we can't simply unset the item, and since we map arrays
 through wp_setup_nav_menu_item like a dozen places, we'd have to make a
 lot of changes.

 We could pair array_map() calls with array_filter(), and return null from
 wp_setup_nav_menu_item(), but that's not very DRY. I think at this point
 that's our best case scenario however, as it is a minimal code change, and
 we would revert much of [15219].

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13822#comment:7>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list