Make WordPress Core

Ticket #58404: 58404.patch

File 58404.patch, 851 bytes (added by nihar007, 6 months ago)

I added a filter hook before update a term called pre_update_term

  • src/wp-includes/taxonomy.php

    diff --git a/src/wp-includes/taxonomy.php b/src/wp-includes/taxonomy.php
    index 71280f0437..472558f2c7 100644
    a b function wp_update_term( $term_id, $taxonomy, $args = array() ) { 
    31543154        // First, get all of the original args.
    31553155        $term = get_term( $term_id, $taxonomy );
    31563156
     3157        /**
     3158         * Filters a term before it is sanitized and updated into the database.
     3159         *
     3160         * @since 6.3.0
     3161         *
     3162         * @param string|WP_Error $term     The term name to add, or a WP_Error object if there's an error.
     3163         * @param string          $taxonomy Taxonomy slug.
     3164         * @param array|string    $args     Array or query string of arguments passed to wp_update_term().
     3165         */
     3166        $term = apply_filters( 'pre_update_term', $term, $taxonomy, $args );
     3167
    31573168        if ( is_wp_error( $term ) ) {
    31583169                return $term;
    31593170        }