Support

Account

Home Forums Backend Issues (wp-admin) When selecting taxonomy ACF Fields disappear (because of wp_ajax_acf/location/m)

Solving

When selecting taxonomy ACF Fields disappear (because of wp_ajax_acf/location/m)

  • I have a custom post type and a custom taxonomy with custom capabilities.
    I also have a custom user role.

    When I edit my custom post type, logged in as user with custom role,
    when I choose a taxonomy the ACF fields disappear.

    When I click to the taxonomy an AJAX call occurs with action: acf/location/match_field_groups_ajax

    This call return an empty array -> [] and then the acf-hidden class is added to the acf postbox and the fields are disappearing.

    When I’m doing the same thing, but logged in as Administrator, the AJAX call returns a number -> [92]
    (This number is the number of the id of the acf postbox -> <div id=”acf_92″ class=”postbox acf_postbox default “> which contains the fields. )
    and nothing wrong is happening.

    To prevent this error I commented out this line -> add_action(‘wp_ajax_acf/location/match_field_groups_ajax’, array($this, ‘match_field_groups_ajax’));
    from core/controllers/location.php

    The truth is I don’t like this solution.

    How can I remove this action from my functions.php file?

    I use:
    WP 3.9
    ACF 4.3.7

  • I implemented the code below to temporarily overcome this problem:

    jQuery(document).ajaxComplete( function( event, XMLHttpRequest, ajaxOptions ){
    var str = ajaxOptions.data;
    var search_string = “acf%2Flocation%2Fmatch_field_groups_ajax”;
    if (str.search(search_string) > 0) {
    jQuery(“#acf_95”).removeClass(“acf-hidden”);
    }
    });

  • Hi apostolix,

    Thanks for sharing your solution.

    I have the same problem but with all user types and your solution didn’t work for me even though I’ve changed your code to match my fields and the location

    I would appreciate it if you could elaborate a bit more on this issue so I can try to fix it.

    Many thanks!

  • i’m also having the same issue in my front end form.

    if you can put some light on the code you posted it will be great help for me.

    here is my thread

    http://support.advancedcustomfields.com/forums/topic/genesis-and-texonomy-field-issue/

    Thanks in advance.

  • apostolix’s code is correct you just need to make sure you point out to the correct form id, in apostolix’s case was acf_95 but yours will be different for sure.

    Also make sure nothing else on the page is using that same id (this was my problem)

  • where do i put this code?
    is it in the functions.php?

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.