Support

Account

Forum Replies Created

  • this is old but it’s the first post i found when looking for something like this. i found a solution on another forum – try it? https://www.awesomeacf.com/forcing-acf-field-group-json-file-generation-for-all-field-groups/ – sorry for digging up an old thread.

  • i have used this intuitively and it has worked from day 1 not knowing really how or why.

    if you add class hidden to the field, it won’t appear on the admin view / backend but it is still usable.

    we use that all the time.

  • also experiencing this these last few days. tried to disable and re-enable, no luck.

  • old topic, but you can also just add this to wp-config.php instead of adding another plugin.

    // limit revisions to prevent db bloating
    define('WP_POST_REVISIONS', 3);
  • I used your function, @hube2

    function acf_wp_kses_post($data) {
      if (!is_array($data)) {
        return wp_kses_post($data);
      }
      $return = array();
      foreach ($data as $index => $value) {
        $return[$index] = acf_wp_kses_post($value);
      }
      return $return;
    }
    

    and replaced it in the filter above. seems to work!

    you guys are amazing, thank you πŸ™‚

  • ok – update. for me, this ticket on another plugin helped me :

    I had recently added some code to that particular theme because (long story) this is a multisite, and in multisites there are restrictions that prevent non super-admins from adding iframes or embeds so I created a field for code with ACF that I run through this filter:

    // remove the html filter on all ACF fields
    add_filter('acf/allow_unfiltered_html', 'mfo_acf_allow_unfiltered_html_all_fields');
    function mfo_acf_allow_unfiltered_html_all_fields() {
        return true;
    }
    // re-apply filter to non-code fields
    add_filter('acf/update_value', 'mfo_acf_disallow_unfiltered_html_non_code_field', 1, 3);
    function mfo_acf_disallow_unfiltered_html_non_code_field($value, $post_id, $field){
            if(
                $field['type'] !== 'acf_code_field'){
                $value = wp_kses_post($value);
    		}
    
        return $value;
    }
    

    this is what breaks the ACF relationship add…

    the function wp_kses_post mentioned in the link above put me on the right track. so now, I need to find a way to add that filter without breaking ACF… any suggestions? I can open a different thread if you prefer.

  • just saw your reply, sorry!

    i added two items from the relationship field:

    Array
    (
        [field_5f3fc9e272878] => Array
            (
                [0] => 7912
                [1] => 7897
            )
    
    )
    

    and that seems to be a good thing πŸ˜‰

    let me know what you think and thanks as always,

    Kaz

  • further – this error ☝🏼 only occurs if I touch the ACF field in question, (which I already tried to duplicate and rebuild, no luck) not if I touch the content or other areas.

    Kaz

  • ok – i was able to eliminate some noise from the error_log, and I can identify this line item that may be related to the issue, which turns out happens on all NEW fields for ALL sites using THIS theme, not another.

    the only log that appears on save of the post is this:

    
    [Thu Feb 25 13:47:15 2021] [warn] [client 213.32.4.94] mod_fcgid: stderr: PHP Warning:  preg_match() expects parameter 2 to be string, array given in /var/www/vhosts/inovie.fr/httpdocs/wp-includes/class-wp-block-parser.php on line 417, referer: https://labosud.fr/wp-admin/post.php?post=7912&action=edit
    [Thu Feb 25 13:47:15 2021] [warn] [client 213.32.4.94] mod_fcgid: stderr: PHP Warning:  strlen() expects parameter 1 to be string, array given in /var/www/vhosts/inovie.fr/httpdocs/wp-includes/class-wp-block-parser.php on line 489, referer: https://labosud.fr/wp-admin/post.php?post=7912&action=edit
    

    …which comes from a core file… so not sure what to do with that.

    thanks again for your help!

    Kaz

  • how can i do a json / other dump of the save post to see the data that ACF is receiving?

  • John,

    Thanks for the swift reply and all the work you do on ACF. Been following you for a while.

    This happens on all posts that have a repeater. Regular fields work fine. It happens 100% of the time on those posts. Old values get erased if they existed before (specifically relationship fields).

    It happens only on one site even though the other sites use the same theme and share the same functions.php and server config.

    This just started happening – possibly related to the latest upgrade but not sure.

    How can I help you help me find out what’s up?

  • also experiencing the same issue out of nowhere. what’s stranger is that this is on a multisite, with dozens of sites. all but one function. they use the same themes, they use the same servers, databases, etc. the issue is only on one of the sites. i looked into the max_inputs_vars and added php.ini directives for that.

    no luck.

    old values get erased, new custom fields don’t get saved.

    this only happens on one specific site of the multisite, all other sites using the same theme don’t have that problem.

    i tried to switch themes on the problematic site, and it saved.

    i am not sure where to look exactly to solve this problem, although I understand it may be something we did in our custom theme that’s breaking – if you have a way to help me find out what is breaking i can try to fix it πŸ˜‰

    thanks!

    k

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