Support

Account

Forum Replies Created

  • Hi John and others

    I’ve finally tracked down what was causing my problem with the repeater field. There were circumstances when I was calling ACF code too early in the overall initialisation process. I moved some of my initialisation to be triggered later (fired on WordPress init) and the problem is solved.

    Hopefully this will help others

  • Hi John

    Thanks for this. I do use the plugins_loaded hook, but there could be paths through my code where this happens too late (my plugin is supposed to run in certain circumstances without needing to fire up WordPress fully.

    Thanks for the initial hint – could be what I need to find the solution.

    Thanks, David

  • Sorry John, I misinterpreted your role (thought you worked for the developer). I’ll look further and post back if I get any further insights. My plugin is interfering in some way, but I don’t really understand what is happening…

    Cheers, David

  • Hi John

    Without giving away too much, can you give me a hint what WordPress context must have been set up for the repeater field to initialise correctly? Failing that, please tell me which ACF routine is called and I’ll debug it. I’m sure there is something subtle in the ordering of calls, but as I have little or no know-how of the internals of ACF, it is hard for me to work out what might be the issue.

    BTW, this is not the first time that a problem like this has been found with repeaters: what was the solution last time?

    Thanks, David

  • …and…

    In the first (broken) case, the “parent” has the value 3690.

    If I enter …/wp-admin/post.php?post=3690&action=edit within WordPress, it shows me the edit screen for the field group.

  • Hi John

    I’ve now had some time to do some digging. I can reproduce the problem with my repeater field called “fields”, which is attached both to option pages and to cdertain custom posts.

    There is some difference between the paths through my code, but I am stumped what is going on. Perhaps some initialisation is not complete in one case but is complete in the other.

    Anyhow, in one case, get_field(‘fields’, ‘option’) returns the value 8. And in the other it returns an array of sub-fields. I stuck some debugging code into ACF’s get_fields function in api_template.php. The two cases look like this:

    get_field fields
    array(23) {
      ["ID"]=>
      int(3220)
      ["key"]=>
      string(19) "field_553bf4f728d48"
      ["label"]=>
      string(6) "Fields"
      ["name"]=>
      string(6) "fields"
      ["prefix"]=>
      string(0) ""
      ["type"]=>
      string(8) "repeater"
      ["value"]=>
      NULL
      ["menu_order"]=>
      int(1)
      ["instructions"]=>
      string(0) ""
      ["required"]=>
      int(0)
      ["id"]=>
      string(0) ""
      ["class"]=>
      string(0) ""
      ["conditional_logic"]=>
      int(0)
      ["parent"]=>
      int(3690)
      ["wrapper"]=>
      array(3) {
        ["width"]=>
        string(0) ""
        ["class"]=>
        string(0) ""
        ["id"]=>
        string(0) ""
      }
      ["_name"]=>
      string(6) "fields"
      ["_input"]=>
      string(0) ""
      ["_valid"]=>
      int(1)
      ["collapsed"]=>
      string(0) ""
      ["min"]=>
      string(0) ""
      ["max"]=>
      string(0) ""
      ["layout"]=>
      string(5) "table"
      ["button_label"]=>
      string(19) "Eintrag hinzufügen"
    }
    

    and

    get_field fields
    array(24) {
      ["ID"]=>
      int(0)
      ["key"]=>
      string(19) "field_553bf4f728d48"
      ["label"]=>
      string(6) "Fields"
      ["name"]=>
      string(6) "fields"
      ["prefix"]=>
      string(0) ""
      ["type"]=>
      string(8) "repeater"
      ["value"]=>
      NULL
      ["menu_order"]=>
      int(1)
      ["instructions"]=>
      string(0) ""
      ["required"]=>
      int(0)
      ["id"]=>
      string(0) ""
      ["class"]=>
      string(0) ""
      ["conditional_logic"]=>
      int(0)
      ["parent"]=>
      string(19) "group_56ade92322eae"
      ["wrapper"]=>
      array(3) {
        ["width"]=>
        string(0) ""
        ["class"]=>
        string(0) ""
        ["id"]=>
        string(0) ""
      }
      ["_name"]=>
      string(6) "fields"
      ["_input"]=>
      string(0) ""
      ["_valid"]=>
      int(1)
      ["collapsed"]=>
      string(0) ""
      ["min"]=>
      string(0) ""
      ["max"]=>
      string(0) ""
      ["layout"]=>
      string(5) "table"
      ["button_label"]=>
      string(19) "Eintrag hinzufügen"
      ["sub_fields"]=>
      array(8) {
        [0]=>
        array(25) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_56955dd93546a"
          ["label"]=>
          string(8) "Template"
          ["name"]=>
          string(8) "template"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(8) "textarea"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(0)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(0)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          int(0)
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(25)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(8) "template"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["default_value"]=>
          string(0) ""
          ["placeholder"]=>
          string(0) ""
          ["maxlength"]=>
          string(0) ""
          ["rows"]=>
          int(4)
          ["new_lines"]=>
          string(7) "wpautop"
          ["readonly"]=>
          int(0)
          ["disabled"]=>
          int(0)
        }
        [1]=>
        array(25) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_553bf52028d4a"
          ["label"]=>
          string(11) "Input field"
          ["name"]=>
          string(11) "input_field"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(4) "text"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(1)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(0)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          array(1) {
            [0]=>
            array(1) {
              [0]=>
              array(3) {
                ["field"]=>
                string(19) "field_55435282b6fb1"
                ["operator"]=>
                string(2) "!="
                ["value"]=>
                string(8) "template"
              }
            }
          }
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(11) "input_field"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["default_value"]=>
          string(0) ""
          ["placeholder"]=>
          string(0) ""
          ["prepend"]=>
          string(0) ""
          ["append"]=>
          string(0) ""
          ["maxlength"]=>
          string(0) ""
          ["readonly"]=>
          int(0)
          ["disabled"]=>
          int(0)
        }
        [2]=>
        array(25) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_55425787757b6"
          ["label"]=>
          string(8) "Mappings"
          ["name"]=>
          string(8) "mappings"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(8) "textarea"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(2)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(0)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          int(0)
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(15)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(8) "mappings"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["default_value"]=>
          string(0) ""
          ["placeholder"]=>
          string(0) ""
          ["maxlength"]=>
          string(0) ""
          ["rows"]=>
          int(4)
          ["new_lines"]=>
          string(7) "wpautop"
          ["readonly"]=>
          int(0)
          ["disabled"]=>
          int(0)
        }
        [3]=>
        array(27) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_553bf53b50eb8"
          ["label"]=>
          string(8) "Function"
          ["name"]=>
          string(8) "function"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(6) "select"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(3)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(1)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          array(1) {
            [0]=>
            array(1) {
              [0]=>
              array(3) {
                ["field"]=>
                string(19) "field_55435282b6fb1"
                ["operator"]=>
                string(2) "!="
                ["value"]=>
                string(8) "template"
              }
            }
          }
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(8) "function"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["choices"]=>
          array(34) {
            ["(just copy)"]=>
            string(11) "(just copy)"
            ["build subtitle"]=>
            string(14) "build subtitle"
            ["build subtitle*"]=>
            string(15) "build subtitle*"
            ["clean up text"]=>
            string(13) "clean up text"
            ["contributors list"]=>
            string(17) "contributors list"
            ["contributors list*"]=>
            string(18) "contributors list*"
            ["convert terms to names"]=>
            string(22) "convert terms to names"
            ["create route"]=>
            string(12) "create route"
            ["get term ID list"]=>
            string(16) "get term ID list"
            ["get term name list"]=>
            string(18) "get term name list"
            ["handle categories"]=>
            string(17) "handle categories"
            ["handle categories*"]=>
            string(18) "handle categories*"
            ["handle gallery"]=>
            string(14) "handle gallery"
            ["handle image"]=>
            string(12) "handle image"
            ["handle media image"]=>
            string(18) "handle media image"
            ["meta data"]=>
            string(9) "meta data"
            ["process contributors"]=>
            string(20) "process contributors"
            ["process contributors*"]=>
            string(21) "process contributors*"
            ["process date/time"]=>
            string(17) "process date/time"
            ["process date/time*"]=>
            string(18) "process date/time*"
            ["process excerpt"]=>
            string(15) "process excerpt"
            ["process excerpt*"]=>
            string(16) "process excerpt*"
            ["process homepage feed"]=>
            string(21) "process homepage feed"
            ["process homepage feed*"]=>
            string(22) "process homepage feed*"
            ["process links"]=>
            string(13) "process links"
            ["process links*"]=>
            string(14) "process links*"
            ["process location"]=>
            string(16) "process location"
            ["process location*"]=>
            string(17) "process location*"
            ["process menu"]=>
            string(12) "process menu"
            ["process menu*"]=>
            string(13) "process menu*"
            ["process permalink"]=>
            string(17) "process permalink"
            ["process permalink*"]=>
            string(18) "process permalink*"
            ["process redirections"]=>
            string(20) "process redirections"
            ["process redirections*"]=>
            string(21) "process redirections*"
          }
          ["default_value"]=>
          array(1) {
            ["(just copy)"]=>
            string(11) "(just copy)"
          }
          ["allow_null"]=>
          int(0)
          ["multiple"]=>
          int(0)
          ["ui"]=>
          int(0)
          ["ajax"]=>
          int(0)
          ["placeholder"]=>
          string(0) ""
          ["disabled"]=>
          int(0)
          ["readonly"]=>
          int(0)
        }
        [4]=>
        array(25) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_553bf4cf28d47"
          ["label"]=>
          string(12) "Output field"
          ["name"]=>
          string(12) "output_field"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(4) "text"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(4)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(1)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          int(0)
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(12) "output_field"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["default_value"]=>
          string(0) ""
          ["placeholder"]=>
          string(0) ""
          ["prepend"]=>
          string(0) ""
          ["append"]=>
          string(0) ""
          ["maxlength"]=>
          string(0) ""
          ["readonly"]=>
          int(0)
          ["disabled"]=>
          int(0)
        }
        [5]=>
        array(22) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_567952d8e077e"
          ["label"]=>
          string(12) "Local output"
          ["name"]=>
          string(12) "local_output"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(8) "checkbox"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(5)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(0)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          array(1) {
            [0]=>
            array(1) {
              [0]=>
              array(3) {
                ["field"]=>
                string(19) "field_55435282b6fb1"
                ["operator"]=>
                string(2) "!="
                ["value"]=>
                string(8) "template"
              }
            }
          }
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(12) "local_output"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["choices"]=>
          array(4) {
            ["blob"]=>
            string(4) "blob"
            ["feed"]=>
            string(4) "feed"
            ["tsv"]=>
            string(3) "tsv"
            ["hidden"]=>
            string(6) "hidden"
          }
          ["default_value"]=>
          array(1) {
            ["blob"]=>
            string(4) "blob"
          }
          ["layout"]=>
          string(8) "vertical"
          ["toggle"]=>
          int(0)
        }
        [6]=>
        array(22) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_56795385c1e73"
          ["label"]=>
          string(13) "Export output"
          ["name"]=>
          string(13) "export_output"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(8) "checkbox"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(6)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(0)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          array(1) {
            [0]=>
            array(1) {
              [0]=>
              array(3) {
                ["field"]=>
                string(19) "field_55435282b6fb1"
                ["operator"]=>
                string(2) "!="
                ["value"]=>
                string(8) "template"
              }
            }
          }
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(13) "export_output"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["choices"]=>
          array(3) {
            ["blob"]=>
            string(4) "blob"
            ["feed"]=>
            string(4) "feed"
            ["tsv"]=>
            string(3) "tsv"
          }
          ["default_value"]=>
          array(0) {
          }
          ["layout"]=>
          string(8) "vertical"
          ["toggle"]=>
          int(0)
        }
        [7]=>
        array(23) {
          ["ID"]=>
          int(0)
          ["key"]=>
          string(19) "field_55435282b6fb1"
          ["label"]=>
          string(8) "Back End"
          ["name"]=>
          string(8) "back_end"
          ["prefix"]=>
          string(0) ""
          ["type"]=>
          string(5) "radio"
          ["value"]=>
          NULL
          ["menu_order"]=>
          int(7)
          ["instructions"]=>
          string(0) ""
          ["required"]=>
          int(1)
          ["id"]=>
          string(0) ""
          ["class"]=>
          string(0) ""
          ["conditional_logic"]=>
          int(0)
          ["parent"]=>
          string(19) "field_553bf4f728d48"
          ["wrapper"]=>
          array(3) {
            ["width"]=>
            int(10)
            ["class"]=>
            string(0) ""
            ["id"]=>
            string(0) ""
          }
          ["_name"]=>
          string(8) "back_end"
          ["_input"]=>
          string(0) ""
          ["_valid"]=>
          int(1)
          ["choices"]=>
          array(4) {
            ["no display"]=>
            string(10) "no display"
            ["date/status"]=>
            string(11) "date/status"
            ["info"]=>
            string(4) "info"
            ["template"]=>
            string(8) "template"
          }
          ["other_choice"]=>
          int(0)
          ["save_other_choice"]=>
          int(0)
          ["default_value"]=>
          string(10) "no display"
          ["layout"]=>
          string(8) "vertical"
        }
      }
    }
    

    Please give me a hint what I need to look for in my code. Or maybe I can call something to force ACF to initialise fully?

    Thanks

    David

  • Hi Jonathan

    I have a feeling that this might have been fixed in the meanwhile. It seems to have got better in any case.

    Thx D

  • I have the JSON fields file if that would be useful. Can I send it to you somehow?

  • Hi John

    I don’t think I have any duplicated option field names, at least not intentionally. What is the case, is that I have a “tab” field with the same name as the “repeater”, but this was not a problem in the past, and I didn’t think that tab fields create data fields as such.

    My phone screen is a bit small to check the field names. I’ll do it later on when I have my laptop.

    The field name “fields” is not a problem hopefully? And also perhaps relevant is that the containing field group (which this repeater is in) is also used on normal posts.

  • Hi John

    Thanks for the idea. Here are the field name and subfields:

    Repeater: “Fields”
    Subfields:
    – template
    – input_field
    – mappings
    – function
    – output_field
    – local_output
    – export_output
    – back_end

    I actually access the repeater “fields” using “field_nnn” notation, though, as I thought this might be an issue.

    Thanks, David

  • Hi

    Was there any progress on this point yet? I’m rather blocked by it as it breaks my site when the repeater on the option page is mucked up because get_fields doesn’t return the content but just the array length.

    Or perhaps a workaround?

    Thanks, David

  • I also saw this problem yesterday. I have not changed anything that is material from my point of view. Certainly there were neither plugin or theme changes that could be relevant

    For me it does not always happen. Re activating ACF Pro helped a c0uple of times, but I cannot understand the pattern.

  • (even when I use the field_nnn notation, by the way)

  • I have exactly this problem again. The repeater field is called “fields” – could that be relevant?

    Everything worked fine, but I cannot see what I could have changed that broke this.

    get_fields with this field returns the length of the repeater array rather than its content. Also, this seems to be happening for the field group attached to the options page

  • I have this problem too. It is really annoying. I am creating a back end plugin that is in English, but I am working in a German WordPress environment. The visible names of the fields get translated AND I DO NOT WANT THIS

    Would it be possible either to have an option somewhere to suppress this, or a notational mechanism to get around it?

  • Would it be possible at least to be able to override the CSS class settings on #post-body to use class “columns-1” for options pages? Is there any simple way that I can override that? For example, can I not use the WordPress filter screen_layout_columns? – but what would the value of the $column index be?

    I didn’t find any hints how to do this anywhere, unfortunately.

  • I found a solution myself. Access $_POST[‘acf’][‘field_xxxxxxxx’]

    Tricky to find! Thanks for the other hints.

  • Thanks codydoodle. My ISP refused to change the max vars limit, but in the end that wasn’t the problem. There was a rogue bit of PHP in my functions.php that was messing with the post variables before they were being stored…

    That’s fixed and I’m more or less back to normal now 😉

  • Also, an export followed by an import simply created a set of text fields WITHOUT ANY ERROR MESSAGE

  • I am having a similar problem which is driving me to distraction. Updates simply do not work. My field definitions get thrown away and all replaced with text type fields (if at all). I am on the point of ditching your plugin because I can’t take the risk that my work just gets destroyed without warning. There are NO error messages. HELP HELP HELP!

  • I just had this error. Basically the last save I did meant that around 10 hand-crafted field definitions just got converted into “text” fields. I AM NOT AMUSED!

    Can’t ACF at least monitor the settings that are causing this and warn before losing data?

    Is there no way to revert to the previous state of the field definitions?

    It is really most tedious and I am not looking forward to the pain of getting it working again. On top of that, I need to have the changes done by my ISP which is a whole business involving help desks and the like!

  • I found the solution – silly me – there is also a field type for my needs that I had missed because my page was localised in German!

    Sorry!

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