Support » Plugin: Advanced Custom Fields » Latest Update Gives Many Undefined Index Errors

  • Resolved MAgencyDev


    Just updated the new version of this wonderful plugin which I use everywhere on my websites, including the public website and WP dashboard on the Options page.

    Unfortunately the new update caused many undefined index errors to pop up now. I think I know a symptom of the cause. It is because I add a group of custom field options with different features to my page template, so the code for the field is there (with an if conditional to check for values) whether there is any information in the field or not. With the new conditional logic feature (amazing new addition) I allow the user to chose whether or not they want to use that feature with a check box on the WP Edit screen. For instance I have setup a special video player and photo album code that will appear or not based on the user entering the values for those fields. I am very excited for this new way of creating theme options on pages.

    So what I have come to realize is this “undefined index error” message appears when there is no information entered in a field, while the code is still there checking if it exists. Before the update all I needed was an if conditional for field values so it would check whether to use the rest of the code. Now apparently it causes PHP to attempt to access something that is not there, therefore giving me the undefined index error. I looked into this a little bit and apparently it is something that happens in plugins when isset() is not used correctly.

    The error only appears in the latest update of this plugin. Please fix so I can update my website without worrying a bunch of these errors will now appear.

    Below is an example code that causes the error when the initial if conditional returns no value.

    				if(get_field('testimonials')) : ?>
    					<ul id="testimonials">
    					<?php while(the_repeater_field('testimonials')) : ?>
    						<p><?php the_sub_field('feedback') ?><br />
    						<em><?php the_sub_field('customer') ?></em></p>
    					<?php endwhile; ?>
    					</ul><!-- end .testimonials -->
    				<?php endif; // end testimonials fields ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author elliotcondon


    Hi @mpswebdev

    Can you report the actual error?
    Also, does updating to help?


    Oh thank you! 3.5.3 was giving the undefined errors but fixed it. Great.

    I saw similar PHP Notices with 3.5.3 when WP_DEBUG in wp-config.php was set to true.

    Edit: Seems to be fixed with

    Was able to reproduce the PHP Notice with 3.5.3 by using get_field( 'some-non-existing-field' ) somewhere:

    Notice: Undefined index: key in /var/.../htdocs/wp-content/plugins/advanced-custom-fields/core/fields/acf_field.php on line 236

    Plugin Author elliotcondon


    Hi @ov3rfly

    Thanks, my WP_DEBUG is always true. I think my server was just being lenient with action/hook PHP errors…

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Latest Update Gives Many Undefined Index Errors’ is closed to new replies.