function wp_update_link( $linkdata ) {}

Update a link in the database.


  • array $linkdata: Link data to update.

Return values

returns:Value 0 or WP_Error on failure. The updated link ID on success.

Source code

function wp_update_link( $linkdata ) {

	$link_id = (int) $linkdata['link_id'];

	$link = get_bookmark( $link_id, ARRAY_A );

	// Escape data pulled from DB.

	$link = add_magic_quotes( $link );

	// Passed link category list overwrites existing category list if not empty.

	if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )

			 && 0 != count( $linkdata['link_category'] ) )

		$link_cats = $linkdata['link_category'];


		$link_cats = $link['link_category'];

	// Merge old and new fields with new fields overwriting old ones.

	$linkdata = array_merge( $link, $linkdata );

	$linkdata['link_category'] = $link_cats;

	return wp_insert_link( $linkdata );



No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: