Ticket #13822: generalize-object-change-logic.1.diff
File generalize-object-change-logic.1.diff, 1.1 KB (added by , 15 years ago) |
---|
-
wp-includes/nav-menu.php
780 780 781 781 // give menu items draft status if their associated post objects change from "publish" to "draft", or vice versa (draft item being re-published) 782 782 if ( 783 ! empty( $post->ID ) && 784 ( 785 ( 'publish' == $old_status && 'draft' == $new_status ) || 786 ( 'draft' == $old_status && 'publish' == $new_status ) 787 ) 783 ! empty( $post->ID ) && ! empty( $post->post_type ) && 784 'nav_menu_item' != $post->post_type && 785 ( 'publish' == $old_status || 'publish' == $new_status ) 788 786 ) { 789 787 $menu_items = get_posts(array( 790 788 'meta_key' => '_menu_item_object_id', … … 796 794 foreach( (array) $menu_items as $menu_item ) { 797 795 if ( ! empty( $menu_item->ID ) ) { 798 796 $properties = get_object_vars( $menu_item ); 799 $properties['post_status'] = $new_status;797 $properties['post_status'] = 'publish' == $new_status ? 'publish' : 'draft'; 800 798 801 799 wp_insert_post( $properties ); 802 800 }