Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: delete_user

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
422  * @param int $reassign Optional. Reassign posts and links to new User ID.
423  * @return bool True when finished.
424  */
425 function wp_delete_user( $id, $reassign = 'novalue' ) {
426      global $wpdb;
427
428      $id = (int) $id;
429
430      // allow for transaction statement
431      do_action('delete_user', $id);
432
433      if ( 'novalue' === $reassign || null === $reassign ) {
434           $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
435
436           if ( $post_ids ) {
437                foreach ( $post_ids as $post_id )
438                     wp_delete_post($post_id);
439           }
440