WordPress.org

Make WordPress Core


Ignore:
Timestamp:
07/05/2020 11:11:46 AM (17 months ago)
Author:
SergeyBiryukov
Message:

Taxonomy: Introduce saved_term and saved_{$taxonomy} actions to complement created_term and created_{$taxonomy}.

This allows for hooking into both the create and update events with a single callback, in the same way that is already possible for posts via the save_post and save_post_{$post->post_type} actions.

Props dlh.
Fixes #48416.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/taxonomy.php

    r48214 r48314  
    24152415    do_action( "created_{$taxonomy}", $term_id, $tt_id );
    24162416
     2417    /**
     2418     * Fires after a term has been saved, and the term cache has been cleared.
     2419     *
     2420     * @since 5.5.0
     2421     *
     2422     * @param int    $term_id  Term ID.
     2423     * @param int    $tt_id    Term taxonomy ID.
     2424     * @param string $taxonomy Taxonomy slug.
     2425     * @param bool   $update   Whether this is an existing term being updated.
     2426     */
     2427    do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false );
     2428
     2429    /**
     2430     * Fires after a term in a specific taxonomy has been saved, and the term
     2431     * cache has been cleared.
     2432     *
     2433     * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
     2434     *
     2435     * @since 5.5.0
     2436     *
     2437     * @param int  $term_id Term ID.
     2438     * @param int  $tt_id   Term taxonomy ID.
     2439     * @param bool $update  Whether this is an existing term being updated.
     2440     */
     2441    do_action( "saved_{$taxonomy}", $term_id, $tt_id, false );
     2442
    24172443    return array(
    24182444        'term_id'          => $term_id,
     
    30783104     */
    30793105    do_action( "edited_{$taxonomy}", $term_id, $tt_id );
     3106
     3107    /** This action is documented in wp-includes/taxonomy.php */
     3108    do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true );
     3109
     3110    /** This action is documented in wp-includes/taxonomy.php */
     3111    do_action( "saved_{$taxonomy}", $term_id, $tt_id, true );
    30803112
    30813113    return array(
Note: See TracChangeset for help on using the changeset viewer.