There’s not much to it, you don’t need to return anything. Note that you also can’t output anything to the browser, that will cause it to fail.
function my_create( $term_id, $tt_id, $taxonomy ){
// do some stuff
}
add_action( 'create_term', 'my_create', 10, 3 );
You mention using this with a custom taxonomy, note that there are also actions that let you hook specific taxonomies:
do_action("create_$taxonomy", $term_id, $tt_id);
Related Posts:
- get_term and get_term_by return null or false, even though term exists
- What is the action hook that deletes a taxonomy term from the backend? And how to retireve the term id before deleting it?
- Display taxonomy with a maximum number of letters
- Automatically Populate Post Taxonomy Data Based on Post Author Meta Data?
- Create WordPress taxonomies based on theme settings
- add_action with variable as a part of the $tag string
- How can I get the term_id from the action hook ‘set_object_terms’?
- Get the the top-level parent of a custom taxonomy term
- get_terms – only top level
- Custom taxonomy terms not showing as list Gutenberg Editor
- Order get_terms using a Custom Field
- Using pre_get_posts to rewrite search query to display posts from multiple taxonomies
- How to modify the query in taxonomy-custom.php to sort term archives by a custom meta field?
- get_terms() returns an empty array
- wp_options table value
- Custom Taxonomy Meta Admin Column
- Custom Taxonomy Only Showing Top Level Terms in Admin?
- How to assign default taxonomy to pages on ‘save_post’?
- Count number of post in Taxonomy?
- wp_query orderby title and meta key value (WP3.1)
- custom taxonomies on permalink
- List Custom Taxonomy Values according to a Post Meta Value
- Custom Taxonomy Images with Advanced Custom Fields
- How to display term description in empty terms archive?
- get_terms custom order
- Get custom field values of taxonomy terms
- Query Posts by taxonomy/Taxonomy Child Custom order
- Single reusable value for post meta: Custom Taxonomy or Post Meta?
- 404 for a custom taxonomy?
- How to display featured images for all posts with certain taxonomy label?
- Get child product categories from parent product category in WooCommerce
- Adding Age Based WordPress Category
- echo current taxonomy id for this loop?
- Display direct children of the current custom taxonomy in taxonomy.php template
- Posts in loop displaying all taxonomies
- Can you filter wp_dropdown_categories with terms meta?
- one term two taxonomy’s?
- Custom Taxonomy in REST API
- Page and Post return 404 with custom taxonomy
- Order by taxonomy Value [duplicate]
- Retrieving an intersection of two terms from two different custom taxonomies via API
- Category list with indent children list below current category
- how to change permalinks format for pagination?
- Getting WooCommerce product related child categories
- Creating conditional to display taxonomy term meta
- Custom Taxonomies and parents
- List of Registered Taxonomies of Current Post
- How do I display a custom field from a custom taxonomy in single.php?
- How to get posts which must match both custom taxonomies?
- Display all taxonomy, children and grandchildren with links
- Using custom taxonomies to display hierarchical URLs?
- Taxonomy Parent Name
- Avoid taxonomy-%term%.php if more than one taxonomy
- Custom Taxonomy specific to a Custom Post type – rewrite URL
- Having Issue on Passing Variable into HTML Class Tag
- Proper use of wp_get_object_terms
- Permalink Problems
- Get Terms for Page
- tax_query: Don’t show posts with parent term when they have a corresponding child term applied
- Can’t get taxonomy ID for each post on archive page
- forward/redirect taxonomy archive of term to a page with same name
- How to add a date creation field when a custom taxonomy relationship is created?
- List custom taxonomies associated to an author’s posts
- Why can’t I access Custom Taxonomy metadata?
- Permalinks with custom taxonomies and regular categories
- WP_Query tax_query – Show results if child has parent X
- Singular custom taxonomy label
- Trash Bin for Categories?
- Display just the Post’s parent Category, not child
- Tree view wp-admin terms
- Retrieve the child terms by having the parent’s information
- How to add chained dropdown filter to a wordpress website
- How to get a taxonomy by a term slug?
- Get taxonomy link with post type slug prefix
- Change the Page Title of the Archive Page for Portfolio Tags
- Is it possible to sort the post based on a custom field?
- Why get_terms() behaves strangely when being called in admin (for use in meta box)?
- qtranslate-x problem with custom term description
- Custom Tax Archive of Parents Only?
- Switching from catalog to product category/subcategory
- ‘Post_tag’ taxonomy tags don’t link to existing posts in CMS
- Sorting terms individually for each post
- Looking for suggestions on creating simple database (Help!!)
- Display list of custom taxonomies from a custom post type ordered by their parent
- WordPress hiding posts without content on custom taxonomy query. How to solve?
- get meta fields and taxonomy of any post type
- Custom taxonomy – query returns an error
- Change taxonomy of posts
- Getting grandchildren of a post with a specified custom taxonomy?
- Taxonomy Parameters in WP Query to get posts from two different taxonomies
- Update fields with post object and custom tax with wp_insert_post
- Get Posts with matching lowest taxonomies
- Can you orderby slug in a taxonomy archive page using WP_Query?
- Any way to make custom taxonomy field searchable?
- Select Custom Taxonomy from Theme Options
- Taxonomy to display form after creation
- How home my code doesn’t display any feature image? Looping through post from a taxonomy and not getting feature images back
- Add taxonomy fields of posts into RSS feed
- Add text in custom taxonomy
- How do I check if a post has a term with a particular ancestor/parent?