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. Built from https://develop.svn.wordpress.org/trunk@48314 git-svn-id: http://core.svn.wordpress.org/trunk@48083 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5b7774722e
commit
de751a91db
|
@ -4207,7 +4207,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
|||
*
|
||||
* @param int $post_ID Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param bool $update Whether this is an existing post being updated or not.
|
||||
* @param bool $update Whether this is an existing post being updated.
|
||||
*/
|
||||
do_action( "save_post_{$post->post_type}", $post_ID, $post, $update );
|
||||
|
||||
|
@ -4218,7 +4218,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
|||
*
|
||||
* @param int $post_ID Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param bool $update Whether this is an existing post being updated or not.
|
||||
* @param bool $update Whether this is an existing post being updated.
|
||||
*/
|
||||
do_action( 'save_post', $post_ID, $post, $update );
|
||||
|
||||
|
@ -4229,7 +4229,7 @@ function wp_insert_post( $postarr, $wp_error = false ) {
|
|||
*
|
||||
* @param int $post_ID Post ID.
|
||||
* @param WP_Post $post Post object.
|
||||
* @param bool $update Whether this is an existing post being updated or not.
|
||||
* @param bool $update Whether this is an existing post being updated.
|
||||
*/
|
||||
do_action( 'wp_insert_post', $post_ID, $post, $update );
|
||||
|
||||
|
|
|
@ -2414,6 +2414,32 @@ function wp_insert_term( $term, $taxonomy, $args = array() ) {
|
|||
*/
|
||||
do_action( "created_{$taxonomy}", $term_id, $tt_id );
|
||||
|
||||
/**
|
||||
* Fires after a term has been saved, and the term cache has been cleared.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param int $term_id Term ID.
|
||||
* @param int $tt_id Term taxonomy ID.
|
||||
* @param string $taxonomy Taxonomy slug.
|
||||
* @param bool $update Whether this is an existing term being updated.
|
||||
*/
|
||||
do_action( 'saved_term', $term_id, $tt_id, $taxonomy, false );
|
||||
|
||||
/**
|
||||
* Fires after a term in a specific taxonomy has been saved, and the term
|
||||
* cache has been cleared.
|
||||
*
|
||||
* The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
|
||||
*
|
||||
* @since 5.5.0
|
||||
*
|
||||
* @param int $term_id Term ID.
|
||||
* @param int $tt_id Term taxonomy ID.
|
||||
* @param bool $update Whether this is an existing term being updated.
|
||||
*/
|
||||
do_action( "saved_{$taxonomy}", $term_id, $tt_id, false );
|
||||
|
||||
return array(
|
||||
'term_id' => $term_id,
|
||||
'term_taxonomy_id' => $tt_id,
|
||||
|
@ -3078,6 +3104,12 @@ function wp_update_term( $term_id, $taxonomy, $args = array() ) {
|
|||
*/
|
||||
do_action( "edited_{$taxonomy}", $term_id, $tt_id );
|
||||
|
||||
/** This action is documented in wp-includes/taxonomy.php */
|
||||
do_action( 'saved_term', $term_id, $tt_id, $taxonomy, true );
|
||||
|
||||
/** This action is documented in wp-includes/taxonomy.php */
|
||||
do_action( "saved_{$taxonomy}", $term_id, $tt_id, true );
|
||||
|
||||
return array(
|
||||
'term_id' => $term_id,
|
||||
'term_taxonomy_id' => $tt_id,
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48313';
|
||||
$wp_version = '5.5-alpha-48314';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue