Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_link

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
394      $linkdata = array_merge($link, $linkdata);
395      $linkdata['link_category'] = $link_cats;
396
397      return wp_insert_link($linkdata);
398 }
399
400 function wp_delete_link($link_id) {
401      global $wpdb;
402
403      do_action('delete_link', $link_id);
404
405      $categories = wp_get_link_cats($link_id);
406      if( is_array( $categories ) ) {
407           foreach ( $categories as $category ) {
408                $wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'");
409                wp_cache_delete($category, 'category');
410                do_action('edit_category', $cat_id);
411           }
412      }