wp_delete_link

函数
wp_delete_link ( $link_id )
参数
  • (int) $link_id ID of the link to delete
    Required:
返回值
  • (true) Always true.
定义位置
相关方法
wp_ajax_delete_linkwp_update_linkwp_delete_filewp_delete_sitewp_get_links
引入
2.0.0
弃用
-

wp_delete_link:此函数从WordPress数据库中删除链接。它将链接ID作为参数,并从数据库中删除链接的元数据和内容。

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

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;
}

常见问题

FAQs
查看更多 >