Support

Account

Home Forums General Issues Creating repeater problematically

Helping

Creating repeater problematically

  • Hi,
    I am trying to add repeater problematically.
    Can you please tell me what’s wrong with this out put array?
    I am getting a lot of warnings on it, and the group is not appearing correctly in the back-end:
    (adding the fields manually will work BTW)

    Array
    (
        [key] => faq_page
        [title] => Faq page
        [fields] => Array
            (
                [key] => faq_page_repeatable
                [name] => faq_page_repeatable
                [label] => Faq page Repeatable
                [type] => repeater
                [layout] => table
                [button_label] => Add Row
                [sub_fields] => Array
                    (
                        [0] => Array
                            (
                                [key] => question
                                [label] => Question
                                [name] => question
                                [type] => wysiwyg
                            )
    
                        [1] => Array
                            (
                                [key] => answer
                                [label] => Answer
                                [name] => answer
                                [type] => wysiwyg
                            )
    
                    )
    
            )
    
        [location] => Array
            (
                [0] => Array
                    (
                        [0] => Array
                            (
                                [param] => page_template
                                [operator] => ==
                                [value] => page-templates/faq.php
                            )
    
                    )
    
            )
    
    )

    Warning: Illegal string offset ‘type’ in /home/ubuntu/workspace/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 287

    Warning: Illegal string offset ‘type’ in /home/ubuntu/workspace/wp-content/plugins/advanced-custom-fields-pro/pro/acf-pro.php on line 316

    Warning: array_shift() expects parameter 1 to be array, string given in /home/ubuntu/workspace/wp-content/plugins/advanced-custom-fields-pro/api/api-field.php on line 1747

  • Hi @avi-fatal

    Could you please check this page to learn more about registering custom fields via PHP: https://www.advancedcustomfields.com/resources/register-fields-via-php/?

    Also, you can always create the field groups from backend and then export it to PHP code from “Custom Fields > Tools” (PRO version) or “Custom Fields > Export” (free version).

    Thanks 🙂

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

The topic ‘Creating repeater problematically’ is closed to new replies.