Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author shawfactor

    (@shawfactor)

    Firstly acf is not a good solution for taxonomies, what you are doing is a hack job. You would be better to use actually use taxonomies on the front end as well.

    Anyway to fix your problem jut set ‘show_admin_column’ => false, when you register the taxonomy.

    Plugin Author shawfactor

    (@shawfactor)

    Let me know if you want assistance on doing ths properly, i am happy to assist

    Thread Starter Mizunga

    (@mizunga)

    Hello again and thanks for your help.

    The problem is that I can’t get to update wp_set_object_terms(), even adding the values myself.

    I got a form in the users profiles to let them select the categories they want to be in. This is the code to update the taxonomies:

    wp_set_object_terms( 1, 25, ‘especialidad’, false); –> this is a manual attempt to check if there was a problem with the values.

    if( !empty( $_POST['select-especialidad'] ) ) {
    
            $term_esp = $_POST['select-especialidad'];
            $term_especialidad = get_term_by('name', $term_esp, 'especialidad');
            $ID_especialidad = $term_especialidad->term_id;
    
            /* Actualizar ACF */
            update_field( 'field_56e933f047e36', $ID_especialidad, $user_id_acf );
    
            /* Actualizar WordPress wp_term_relationships de WordPress
             * Añadir nuevas
             */
            $final_user_id = $current_user->ID;
            wp_set_object_terms( $final_user_id, $ID_especialidad, 'especialidad', false);
            clean_object_term_cache($final_user_id, 'especialidad');
        }

    I know that the code is working fine, because ACF fields get updated, but seems impossible with wp_set_object_terms. Any help is more than welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Do not display taxonomies created with LH in Backend.’ is closed to new replies.