php – Hi need update in my terms for other taxonomy


I’m new to wordpress, and in this case I created 2 taxonomies, cat_notice and trash_notice, what I need to do is when I delete a term, instead of it being deleted, it is reinserted in another taxonomy or is inserted as a child of a term trash_bin.

function trashbin_pre_delete_term( $term_id, $taxonomy_name ) {
 if ( $taxonomy_name === 'trash_notice' ) {
    $objects = get_objects_in_term( $term_id, $taxonomy );

    wp_update_term( $term_id, 'trash_notice');
add_action( 'pre_delete_term', 'trashbin_pre_delete_term' );

Felipe Lenin 5 months 2022-07-05T16:13:04-05:00 0 Answers 0 views 0

Leave an answer