删除原始对象时回调处理菜单项。

原型

_wp_delete_post_menu_item( int $object_id )

参数

$object_id (int) (Required) 被破坏的原始对象的ID。

源文件

路径:wp-includes/nav-menu.php

<?php
...
function _wp_delete_post_menu_item( $object_id = 0 ) {
	$object_id = (int) $object_id;
	$menu_item_ids = wp_get_associated_nav_menu_items( $object_id, 'post_type' );
	foreach ( (array) $menu_item_ids as $menu_item_id ) {
		wp_delete_post( $menu_item_id, true );
	}
}
...
?>

其他

英文文档:https://developer.wordpress.org/reference/functions/_wp_delete_post_menu_item/