从数据库中删除指定的链接。

原型

wp_delete_link( int $link_id )

参数

$link_id (int) (Required) 要删除的链接的ID

返回值

(true)  总是如此。

源文件

路径:wp-admin/includes/bookmark.php

<?php
...
function wp_delete_link( $link_id ) {
	global $wpdb;
	/**
	 * Fires before a link is deleted.
	 *
	 * @since 2.0.0
	 *
	 * @param int $link_id ID of the link to delete.
	 */
	do_action( 'delete_link', $link_id );
	wp_delete_object_term_relationships( $link_id, 'link_category' );
	$wpdb->delete( $wpdb->links, array( 'link_id' => $link_id ) );
	/**
	 * Fires after a link has been deleted.
	 *
	 * @since 2.2.0
	 *
	 * @param int $link_id ID of the deleted link.
	 */
	do_action( 'deleted_link', $link_id );
	clean_bookmark_cache( $link_id );
	return true;
}
...
?>

其他

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