Support

Account

Home Forums Bug Reports ACF Pro – Options pages with Repeaters not working Reply To: ACF Pro – Options pages with Repeaters not working

  • 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