How to use create_term, edit_term, delete_term actions?
-
I’ve created a Custom Taxonomy and I want to hook a function when User adds new Term to my Custom Taxonomy. Can someone please show me how to use following actions in WordPress?
create_term edit_term delete term
All these actions are defined in wp-includes/taxonomy.php as follows:
do_action("create_term", $term_id, $tt_id, $taxonomy); do_action("edit_term", $term_id, $tt_id, $taxonomy); do_action('delete_term', $term, $tt_id, $taxonomy);
Whenever I try to hook my function with add_action, the Custom Taxonomy page works indifferently. Page does not refresh when I add/edit new Taxonomy Term and attempting to delete any existing term gives me error: “An undefined error occurred.” Actually all changes are getting registered to Database… page doesn’t refresh on add/edit, but the Term is added/changed successfully. Even delete action actually deletes the term; I can see the changes when I refresh the page.
I think there is something which the function may need to return… something is holding the WordPress back and I just don’t know what’s going wrong.
Waiting for your valuable reply…
Regards,
Ruturaaj.
- The topic ‘How to use create_term, edit_term, delete_term actions?’ is closed to new replies.