rest_insert_(taxonomy) хук-событиеWP 4.7.0

Fires after a single term is created or updated via the REST API.

The dynamic portion of the hook name, $this->taxonomy, refers to the taxonomy slug.

Possible hook names include:

Использование

add_action( 'rest_insert_(taxonomy)', 'wp_kama_rest_insert_taxonomy_action', 10, 3 );

/**
 * Function for `rest_insert_(taxonomy)` action-hook.
 * 
 * @param WP_Term         $term     Inserted or updated term object.
 * @param WP_REST_Request $request  Request object.
 * @param bool            $creating True when creating a term, false when updating.
 *
 * @return void
 */
function wp_kama_rest_insert_taxonomy_action( $term, $request, $creating ){

	// action...
}
$term(WP_Term)
Inserted or updated term object.
$request(WP_REST_Request)
Request object.
$creating(true|false)
True when creating a term, false when updating.

Список изменений

С версии 4.7.0 Введена.

Где вызывается хук

WP_REST_Terms_Controller::create_item()
rest_insert_(taxonomy)
WP_REST_Terms_Controller::update_item()
rest_insert_(taxonomy)
WP_REST_Menus_Controller::create_item()
rest_insert_(taxonomy)
WP_REST_Menus_Controller::update_item()
rest_insert_(taxonomy)
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 503
do_action( "rest_insert_{$this->taxonomy}", $term, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-terms-controller.php 623
do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );
wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php 237
do_action( "rest_insert_{$this->taxonomy}", $term, $request, true );
wp-includes/rest-api/endpoints/class-wp-rest-menus-controller.php 321
do_action( "rest_insert_{$this->taxonomy}", $term, $request, false );

Где используется хук в WordPress

Использование не найдено.