• Resolved clecocq

    (@clecocq)


    Dear pete,

    Great plugin, thanks ??

    It’s working fine, however I’m using the ACF V5 plugin to set up a “user profile form”. In ACF, I’m using the “taxonomy field”. But when I try to update the user term from the ACF taxonomy field, it’s not working (the term isn’t updated). It’s working for standard post / page / post type.

    It would be amazing if you could have a look at this? (even if I know it’s going further than your plugin).

    If you need more explanation tell me.

    Thanks in advance!

    Cyril

    https://www.ads-software.com/plugins/lh-user-taxonomies/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hey again.

    I’ve managed to bridge the gap until one of the plugins decides if they’ll fix it. The problem is that ACF saves the values as meta data where as this plugin saves it as object terms.
    Paste the below function into your theme’s function.php and it will relate the ACF selections to the object terms (make sure to replace your taxonomy and acf field info)

    function save_usermeta_as_tax ($user_id) {
        $profs = get_field('profession', 'user_'.$user_id);
        wp_set_object_terms( $user_id, $profs, 'profession', false);
        clean_object_term_cache( $user_id, 'profession' );
    }
    add_action('personal_options_update', 'save_usermeta_as_tax', 10);

    Two warnings:
    This will only work one way, meaning you HAVE to use ACF to set the terms when this is active.
    You have to save the user TWICE to get them synced correctly. I’m trying to figure out how to solve that and will post if I do.

    So this is a temporary solution to get your data synced, hopefully it helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Working with ACF V5 taxonomy field’ is closed to new replies.