Support

Account

Home Forums Bug Reports acf_form failing after update

Helping

acf_form failing after update

    • adam_g

    • January 14, 2020 at 3:17 am

    Hello!

    I’m using a frontend form that was working until one of the last acf updates. Now getting an error: Undefined offset: 1 in ...\wp-content\plugins\advanced-custom-fields-pro\includes\api\api-helpers.php on line 4639

    get_header();
    acf_form_head();
    ...
    <?php if (!strpos($_SERVER['REQUEST_URI'], '?thank-you')) : ?>
      <?php the_content(); ?>
      <?php
      $fields = array( // Field groups
        'field_5d0d0b6322401',
        'field_5d0d0bbc22403',
        'field_5d238bd5e3433'
      );
      acf_register_form(array(
        'id'       => 'new-cpt-name',
        'post_id'  => 'new_post',
        'new_post' => array(
          'post_type'   => 'cpt-name',
          'post_status' => 'draft',
        ),
        'post_title'   => false,
        'post_content' => false,
        'uploader'     => 'basic',
        'return'       => get_the_permalink(get_the_ID()).'?thank-you',
        'fields'       => $fields,
        'submit_value' => 'Submit your cpt-name',
        'html_submit_button'  => '<input type="submit" class="btn btn-primary" value="%s" />'
      ));
    
      acf_form('new-cpt-name');
      ?>
    
    <?php else : ?>
      <h2>Thanks for submitting your request!</h2>
      <p>A {...} website administrator will contact you within a week of your submission and provide a link to your custom {...}.</p>
    <?php endif; ?>

    Couple things I’ve tried:
    1. Using output buffering around acf_form_head

    ob_start();
    get_header();
    acf_form_head();
    echo ob_get_clean();

    2. Removing the server request conditional.

    3. Another dev thought it may have to do with acf_validate_value() within \wp-content\plugins\advanced-custom-fields-pro\includes\validation.php , but I could not quite see the issue there.

    Confirmed that this is working with an older version of ACF (5.6.9 I believe).

    Thanks for any help or suggestions with this one!

  • I can confirm having the same problem with this version.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.