@@ 911-919 (lines=9) @@ | ||
908 | * @param int $object_id The ID of the original object being trashed. |
|
909 | * |
|
910 | */ |
|
911 | function _wp_delete_post_menu_item( $object_id = 0 ) { |
|
912 | $object_id = (int) $object_id; |
|
913 | ||
914 | $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' ); |
|
915 | ||
916 | foreach ( (array) $menu_item_ids as $menu_item_id ) { |
|
917 | wp_delete_post( $menu_item_id, true ); |
|
918 | } |
|
919 | } |
|
920 | ||
921 | /** |
|
922 | * Serves as a callback for handling a menu item when its original object is deleted. |
|
@@ 931-939 (lines=9) @@ | ||
928 | * @param int $tt_id Term taxonomy ID. Unused. |
|
929 | * @param string $taxonomy Taxonomy slug. |
|
930 | */ |
|
931 | function _wp_delete_tax_menu_item( $object_id = 0, $tt_id, $taxonomy ) { |
|
932 | $object_id = (int) $object_id; |
|
933 | ||
934 | $menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'taxonomy', $taxonomy ); |
|
935 | ||
936 | foreach ( (array) $menu_item_ids as $menu_item_id ) { |
|
937 | wp_delete_post( $menu_item_id, true ); |
|
938 | } |
|
939 | } |
|
940 | ||
941 | /** |
|
942 | * Automatically add newly published page objects to menus with that as an option. |