Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_attachment

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
371      if ( ! empty($meta['thumb']) ) {
372           // Don't delete the thumb if another attachment uses it
373           if (! $foo = $wpdb->get_row("SELECT meta_id FROM $wpdb->postmeta WHERE meta_key = '_wp_attachment_metadata' AND meta_value LIKE '%".$wpdb->escape($meta['thumb'])."%' AND post_id <> $postid"))
374                @ unlink(str_replace(basename($file), $meta['thumb'], $file));
375      }
376
377      if ( ! empty($file) )
378           @ unlink($file);
379
380      do_action('delete_attachment', $postid);
381
382      return $post;
383 }
384
385 function wp_get_single_post($postid = 0, $mode = OBJECT) {
386      global $wpdb;
387
388      $post = get_post($postid, $mode);
389