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
259  * @param int $reassign Optional. Reassign posts and links to new User ID.
260  * @return bool True when finished.
261  */
262 function wp_delete_user( $id, $reassign = 'novalue' ) {
263      global $wpdb;
264
265      $id = (int) $id;
266
267      // allow for transaction statement
268      do_action('delete_user', $id);
269
270      if ( 'novalue' === $reassign || null === $reassign ) {
271           $post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
272
273           if ( $post_ids ) {
274                foreach ( $post_ids as $post_id )
275                     wp_delete_post($post_id);
276           }
277