Make WordPress Core

Ticket #55441: 55441.diff

File 55441.diff, 7.9 KB (added by mboynes, 4 years ago)

Adds $args to all actions/filters in wp_insert_term and wp_update_term

  • src/wp-includes/taxonomy.php

     
    23312331         *
    23322332         * @param string|WP_Error $term     The term name to add, or a WP_Error object if there's an error.
    23332333         * @param string          $taxonomy Taxonomy slug.
     2334         * @param array           $args     Term arguments passed to the function.
    23342335         */
    2335         $term = apply_filters( 'pre_insert_term', $term, $taxonomy );
     2336        $term = apply_filters( 'pre_insert_term', $term, $taxonomy, $args );
    23362337
    23372338        if ( is_wp_error( $term ) ) {
    23382339                return $term;
     
    25602561         * @param int    $term_id  Term ID.
    25612562         * @param int    $tt_id    Term taxonomy ID.
    25622563         * @param string $taxonomy Taxonomy slug.
     2564         * @param array  $args     Term arguments passed to the function.
    25632565         */
    2564         do_action( 'create_term', $term_id, $tt_id, $taxonomy );
     2566        do_action( 'create_term', $term_id, $tt_id, $taxonomy, $args );
    25652567
    25662568        /**
    25672569         * Fires after a new term is created for a specific taxonomy.
     
    25762578         *
    25772579         * @since 2.3.0
    25782580         *
    2579          * @param int $term_id Term ID.
    2580          * @param int $tt_id   Term taxonomy ID.
     2581         * @param int   $term_id Term ID.
     2582         * @param int   $tt_id   Term taxonomy ID.
     2583         * @param array $args    Term arguments passed to the function.
    25812584         */
    2582         do_action( "create_{$taxonomy}", $term_id, $tt_id );
     2585        do_action( "create_{$taxonomy}", $term_id, $tt_id, $args );
    25832586
    25842587        /**
    25852588         * Filters the term ID after a new term is created.
     
    25862589         *
    25872590         * @since 2.3.0
    25882591         *
    2589          * @param int $term_id Term ID.
    2590          * @param int $tt_id   Term taxonomy ID.
     2592         * @param int   $term_id Term ID.
     2593         * @param int   $tt_id   Term taxonomy ID.
     2594         * @param array $args    Term arguments passed to the function.
    25912595         */
    2592         $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
     2596        $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id, $args );
    25932597
    25942598        clean_term_cache( $term_id, $taxonomy );
    25952599
     
    26042608         * @param int    $term_id  Term ID.
    26052609         * @param int    $tt_id    Term taxonomy ID.
    26062610         * @param string $taxonomy Taxonomy slug.
     2611         * @param array  $args     Term arguments passed to the function.
    26072612         */
    2608         do_action( 'created_term', $term_id, $tt_id, $taxonomy );
     2613        do_action( 'created_term', $term_id, $tt_id, $taxonomy, $args );
    26092614
    26102615        /**
    26112616         * Fires after a new term in a specific taxonomy is created, and after the term
     
    26202625         *
    26212626         * @since 2.3.0
    26222627         *
    2623          * @param int $term_id Term ID.
    2624          * @param int $tt_id   Term taxonomy ID.
     2628         * @param int   $term_id Term ID.
     2629         * @param int   $tt_id   Term taxonomy ID.
     2630         * @param array $args    Term arguments passed to the function.
    26252631         */
    2626         do_action( "created_{$taxonomy}", $term_id, $tt_id );
     2632        do_action( "created_{$taxonomy}", $term_id, $tt_id, $args );
    26272633
    26282634        /**
    26292635         * Fires after a term has been saved, and the term cache has been cleared.
     
    26372643         * @param int    $tt_id    Term taxonomy ID.
    26382644         * @param string $taxonomy Taxonomy slug.
    26392645         * @param bool   $update   Whether this is an existing term being updated.
     2646         * @param array  $args     Term arguments passed to the function.
    26402647         */
    2641         do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false );
     2648        do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false, $args );
    26422649
    26432650        /**
    26442651         * Fires after a term in a specific taxonomy has been saved, and the term
     
    26532660         *
    26542661         * @since 5.5.0
    26552662         *
    2656          * @param int  $term_id Term ID.
    2657          * @param int  $tt_id   Term taxonomy ID.
    2658          * @param bool $update  Whether this is an existing term being updated.
     2663         * @param int   $term_id Term ID.
     2664         * @param int   $tt_id   Term taxonomy ID.
     2665         * @param bool  $update  Whether this is an existing term being updated.
     2666         * @param array $args    Term arguments passed to the function.
    26592667         */
    2660         do_action( "saved_{$taxonomy}", $term_id, $tt_id, false );
     2668        do_action( "saved_{$taxonomy}", $term_id, $tt_id, false, $args );
    26612669
    26622670        return array(
    26632671                'term_id'          => $term_id,
     
    32193227         *
    32203228         * @param int    $term_id  Term ID.
    32213229         * @param string $taxonomy Taxonomy slug.
     3230         * @param array  $args     Arguments passed to wp_update_term().
    32223231         */
    3223         do_action( 'edit_terms', $term_id, $taxonomy );
     3232        do_action( 'edit_terms', $term_id, $taxonomy, $args );
    32243233
    32253234        $data = compact( 'name', 'slug', 'term_group' );
    32263235
     
    32513260         *
    32523261         * @param int    $term_id  Term ID.
    32533262         * @param string $taxonomy Taxonomy slug.
     3263         * @param array  $args     Arguments passed to wp_update_term().
    32543264         */
    3255         do_action( 'edited_terms', $term_id, $taxonomy );
     3265        do_action( 'edited_terms', $term_id, $taxonomy, $args );
    32563266
    32573267        /**
    32583268         * Fires immediate before a term-taxonomy relationship is updated.
     
    32613271         *
    32623272         * @param int    $tt_id    Term taxonomy ID.
    32633273         * @param string $taxonomy Taxonomy slug.
     3274         * @param array  $args     Arguments passed to wp_update_term().
    32643275         */
    3265         do_action( 'edit_term_taxonomy', $tt_id, $taxonomy );
     3276        do_action( 'edit_term_taxonomy', $tt_id, $taxonomy, $args );
    32663277
    32673278        $wpdb->update( $wpdb->term_taxonomy, compact( 'term_id', 'taxonomy', 'description', 'parent' ), array( 'term_taxonomy_id' => $tt_id ) );
    32683279
     
    32733284         *
    32743285         * @param int    $tt_id    Term taxonomy ID.
    32753286         * @param string $taxonomy Taxonomy slug.
     3287         * @param array  $args     Arguments passed to wp_update_term().
    32763288         */
    3277         do_action( 'edited_term_taxonomy', $tt_id, $taxonomy );
     3289        do_action( 'edited_term_taxonomy', $tt_id, $taxonomy, $args );
    32783290
    32793291        /**
    32803292         * Fires after a term has been updated, but before the term cache has been cleaned.
     
    32873299         * @param int    $term_id  Term ID.
    32883300         * @param int    $tt_id    Term taxonomy ID.
    32893301         * @param string $taxonomy Taxonomy slug.
     3302         * @param array  $args     Arguments passed to wp_update_term().
    32903303         */
    3291         do_action( 'edit_term', $term_id, $tt_id, $taxonomy );
     3304        do_action( 'edit_term', $term_id, $tt_id, $taxonomy, $args );
    32923305
    32933306        /**
    32943307         * Fires after a term in a specific taxonomy has been updated, but before the term
     
    33033316         *
    33043317         * @since 2.3.0
    33053318         *
    3306          * @param int $term_id Term ID.
    3307          * @param int $tt_id   Term taxonomy ID.
     3319         * @param int   $term_id Term ID.
     3320         * @param int   $tt_id   Term taxonomy ID.
     3321         * @param array $args    Arguments passed to wp_update_term().
    33083322         */
    3309         do_action( "edit_{$taxonomy}", $term_id, $tt_id );
     3323        do_action( "edit_{$taxonomy}", $term_id, $tt_id, $args );
    33103324
    33113325        /** This filter is documented in wp-includes/taxonomy.php */
    33123326        $term_id = apply_filters( 'term_id_filter', $term_id, $tt_id );
     
    33243338         * @param int    $term_id  Term ID.
    33253339         * @param int    $tt_id    Term taxonomy ID.
    33263340         * @param string $taxonomy Taxonomy slug.
     3341         * @param array  $args     Arguments passed to wp_update_term().
    33273342         */
    3328         do_action( 'edited_term', $term_id, $tt_id, $taxonomy );
     3343        do_action( 'edited_term', $term_id, $tt_id, $taxonomy, $args );
    33293344
    33303345        /**
    33313346         * Fires after a term for a specific taxonomy has been updated, and the term
     
    33403355         *
    33413356         * @since 2.3.0
    33423357         *
    3343          * @param int $term_id Term ID.
    3344          * @param int $tt_id   Term taxonomy ID.
     3358         * @param int   $term_id Term ID.
     3359         * @param int   $tt_id   Term taxonomy ID.
     3360         * @param array $args    Arguments passed to wp_update_term().
    33453361         */
    3346         do_action( "edited_{$taxonomy}", $term_id, $tt_id );
     3362        do_action( "edited_{$taxonomy}", $term_id, $tt_id, $args );
    33473363
    33483364        /** This action is documented in wp-includes/taxonomy.php */
    3349         do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true );
     3365        do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true, $args );
    33503366
    33513367        /** This action is documented in wp-includes/taxonomy.php */
    3352         do_action( "saved_{$taxonomy}", $term_id, $tt_id, true );
     3368        do_action( "saved_{$taxonomy}", $term_id, $tt_id, true, $args );
    33533369
    33543370        return array(
    33553371                'term_id'          => $term_id,