Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Plugin API/Action Reference/edit terms

This page redirects to an external site: https://developer.wordpress.org/reference/hooks/edit_terms/

Description

The edit_terms action is used to hook into code before a term is updated in the database.

A plugin (or theme) can register an action hook from the example below.

Parameters

$term_id
(int) (required) ID of the term about to be edited
Default: None
$taxonomy
(string) (required) Taxonomy slug of the related term
Default: None

Examples

functions.php

<?php 
add_action( 'edit_terms', 'do_something_or_stop_update', 10, 2 ); 

function do_something_or_stop_update( $term_id, $taxonomy ){
    //do something before update OR
    //redirect back to the edit page to disable updates (remember to exit)
}
?>

See Also