Support

Account

Home Forums General Issues Undefined array key “value” in abstract-acf-location.php

Unread

Undefined array key “value” in abstract-acf-location.php

  • I get the warning that $rule[‘value’] in ACF_Location::compare_to_rule is undefined. I checked the values and the $rule parameter only has “param” and “operator” set.

    The warnings all look like this:

    Warning: Undefined array key "value" in /home/u680869368/domains/jaisamusic.schonbald.live/public_html/wp-content/plugins/advanced-custom-fields-pro/includes/locations/abstract-acf-location.php on line 183

    (each time with line 183 and 186 of course)

    The $rule looks like this:

    array(2) { ["param"]=> string(4) "post" ["operator"]=> string(2) "==" }

    To get rid of the warning I added the following line at the beginning of the function.

    if (!isset($rule['value'])) return false;

    Edit: Ok, now I understand where this issue comes from. I have some component field groups that are solely used in clone fields by other field groups. To be sure that they are never shown on any other location, I selected post as rule without a value.

    So this isn’t really an issue with the ACF location class. But it shows a different issue: it should be possible to select “nowhere” as a location for field groups that are only intended to be imported via clone fields.

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.