WordPress.org

Make WordPress Core

Ticket #20645: delete_term-action-as-extra-parameter.diff

File delete_term-action-as-extra-parameter.diff, 984 bytes (added by bigdawggi, 2 years ago)

passing term as extra parameter

  • wp-includes/taxonomy.php

     
    18061806        $wpdb->delete( $wpdb->term_taxonomy, array( 'term_taxonomy_id' => $tt_id ) ); 
    18071807        do_action( 'deleted_term_taxonomy', $tt_id ); 
    18081808 
     1809        // Get the object before deletion so we can pass to actions below 
     1810        $deleted_term = get_term($term, $taxonomy); 
     1811 
    18091812        // Delete the term if no taxonomies use it. 
    18101813        if ( !$wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_taxonomy WHERE term_id = %d", $term) ) ) 
    18111814                $wpdb->delete( $wpdb->terms, array( 'term_id' => $term ) ); 
    18121815 
    18131816        clean_term_cache($term, $taxonomy); 
    18141817 
    1815         do_action('delete_term', $term, $tt_id, $taxonomy); 
    1816         do_action("delete_$taxonomy", $term, $tt_id); 
     1818        do_action( 'delete_term', $term, $tt_id, $taxonomy, $deleted_term ); 
     1819        do_action( "delete_$taxonomy", $term, $tt_id, $deleted_term ); 
    18171820 
    18181821        return true; 
    18191822}