wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



wp_update_link › WordPress Function

Seit2.0.0
Veraltetn/v
wp_update_link ( $linkdata )
Parameter:
  • (array) $linkdata Link data to update. See wp_insert_link() for accepted arguments.
    Erforderlich: Ja
Gibt zurück:
  • (int|WP_Error) Value 0 or WP_Error on failure. The updated link ID on success.
Definiert in:
Codex:

Updates a link in the database.



Quellcode

function wp_update_link( $linkdata ) {
	$link_id = (int) $linkdata['link_id'];

	$link = get_bookmark( $link_id, ARRAY_A );

	// Escape data pulled from DB.
	$link = wp_slash( $link );

	// Passed link category list overwrites existing category list if not empty.
	if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
		&& count( $linkdata['link_category'] ) > 0
	) {
		$link_cats = $linkdata['link_category'];
	} else {
		$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 );
}