V
V
Vladislav Chernenko2021-10-13 17:50:54
WordPress
Vladislav Chernenko, 2021-10-13 17:50:54

How to remove taxonomy term when removing acf sub_field?

Greetings. In general, I create terms for custom taxonomies through the ACF repeater:

add_action('acf/save_post', 'my_acf_save_option_page', 20);	
function my_acf_save_option_page() {
  
  $screen = get_current_screen();
  if (strpos($screen->id, 'theme-settings') == true) {
    
    while( have_rows('field_615da6bb58108', 'option') ) {
      the_row();
      $val = get_sub_field('value');
      
      wp_insert_term($val, 'okna-city');
      wp_insert_term($val, 'dveri-city');

    }
  }
}

but I can’t do the reverse action through wp_delete_term () in any way, it either deletes everything from me, or anyhow))
I would be grateful even for a push in the right direction.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question