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
375      if ( ! empty($meta['thumb']) ) {
376           // Don't delete the thumb if another attachment uses it
377           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'"))
378                @ unlink(str_replace(basename($file), $meta['thumb'], $file));
379      }
380
381      if ( ! empty($file) )
382           @ unlink($file);
383
384      do_action('delete_attachment', $postid);
385
386      return $post;
387 }
388
389 function wp_get_single_post($postid = 0, $mode = OBJECT) {
390      global $wpdb;
391
392      $post = get_post($postid, $mode);
393