custom taxonomy – Trash Bin for Categories?


I have a cat_notice taxonomy, where there are several categories and one of them the slug is ‘trash’. In this case I created a link and I needed that when I clicked on this link I would take the current id of the term and add it as a child of the term ‘trash’.

add_filter( "cat_notice_row_actions", 'trash_row_actions', 10, 2 );
  function trash_row_actions( $actions, $user_object ) {
     // Remove the Edit action.
     unset( $actions['delete'] );
     $termID = $user_object->term_id;
     $termTrash = get_term_by('slug', 'lixeira', 'cat_notice');
     $idTerm = $termTrash->term_id;  
     wp_update_term( $termID, $user_object, array( 'parent' => $termTrash ) );
     $actions['trash_lionx'] = '<a style="color: red" href="">Excluir</a>';
    return $actions;

Please help

Jacob Peattie 5 months 2022-07-06T12:04:19-05:00 0 Answers 0 views 0

Leave an answer