Home Forums Bug Reports Notice: Undefined index: value (…)\core\location.php on line 397


Notice: Undefined index: value (…)\core\location.php on line 397

  • This message appears on the top of the post edit page.

    I’m not sure what causes this issue, because I can see it only one one site which setup doesn’t differ much from other sites that I develop. But I have a feeling that it might be related to a clone field (or a clone field together with a flexible content field) because this is an only site where I use the clone field.

    error logs in location.php on line 397:

      "param": "post",
      "operator": "=="
      "post_id": 331,
      "post_type": "case",
      "page_template": 0,
      "page_parent": 0,
      "page_type": 0,
      "post_status": 0,
      "post_format": 0,
      "post_taxonomy": null,
      "taxonomy": 0,
      "user_id": 0,
      "user_role": 0,
      "user_form": 0,
      "attachment": 0,
      "comment": 0,
      "widget": 0,
      "lang": "",
      "ajax": false

    I can send a copy of the acf-json directory if you think it’s going to be helpful.

  • Check your location rules for your groups. My only guess here is that you chosen

    Post is equal to Some Post

    and the post selected no longer exists

  • No, I have only one rule: post_type === 'case'. But even if you were right then a PHP notice shouldn’t be displayed and it would still be a bug.

  • The line that you indicate is in the function rule_match_post() which is matching an exact post and not a post ID. So somewhere on your site there is a location rule trying to match a post or this function would not be called. The value of the location rule is not set. Do you have field groups registered in PHP anywhere? Maybe in another plugin?

  • Only one field group is assigned and there’s only one simple rule: post_type === 'case', as I mentioned in the previous post. There’s no magic in the code, no custom filters/action, fields are registered with ACF GUI (not with PHP) and stored in the acf-json directory. ACF is the only plugin I use at the moment. So for me it looks like a bug.

    I can send you a PM with compressed acf-json directory. Will it be helpfull?

  • You only have 1 field group created on this site?

    if that’s the case then sust post the location rules for this one field group, open the .json file and just copy the bit with the location rules.

  • > You only have 1 field group created on this site?

    No, I meant that I have only one field group assigned to this post type.

    And you were right. An another fields group (a field group containing a clone field) was assigned to an unexisting post. This caused the issue. I did it because I wanted to prevent a clone group from showing anywhere. I’ve even opened a feature request regarding this issue.

    I’ve resolved this issue changing setting the clone field group to inactive and removing a condition that can never be meet.

    But anyway, I think this is a bug that should be fixed. Even if a field group is assigned to an unexisting post then no error or notice should be displayed.

    Thanks for your help.

  • You can you submit a new ticket for that But the problem isn’t that there is a non-existent post, the problem is that the value is not set at all. Here is an example:

    this location rule will not create an error, but it can never be met since there will never be a post with an ID of 0

    // .....
      'location' => array (
        array (
          array (
            'param' => 'post',
            'operator' => '==',
            'value' => '0',
    // .....

    However, this location rule will cause the error you posted because the value parameter is not included

    // .....
      'location' => array (
        array (
          array (
            'param' => 'post',
            'operator' => '==',
    // .....
  • There are also other methods of doing what you’re attempting to do, for example, setting an location rule that requires two (AND) things that cannot possibly happen at the same time, like a post being equal to 2 different posts, or the post type being equal to 2 different post types.

    The main issue with doing it this way instead of setting a field group to inactive is that ACF takes the time to go through the process of seeing if the groups should be shown, which is an unnecessary process that takes time and reduces performance. When you set the group to inactive then there is no wasted time as ACF tests to see if the field group should be shown.

  • Thanks for deatiled clarification!

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

The topic ‘Notice: Undefined index: value (…)\core\location.php on line 397’ is closed to new replies.