Support

Account

Home Forums Bug Reports Field 41 Bug

Solving

Field 41 Bug

  • Hi, I am making a website and believe I have encountered a rather strange bug.
    I am new to ACF and am trying the free version for now before committing to developing with the paid version. The problem I have is that I do not have the repeater field and so have to do it manually.
    I have set up a page for “Our Team” and so have had to set up a large number of groups for each team member each including name, position etc. 50 to be exact. I then wrote code to loop through each field and display the necessary information, and this worked fine in small scale. However, once I increased the field number to 50 members a bug occurred where member 41 does not display. I have tried moving it to different positions, remaking the field, and much more, the problems seems to be with the number 41 itself.

    Here is the code I used to loop through:

    <?php $team = get_field("team");?>
    
    <div class="team-strip">
    
    <!--loop through field only displaying members(arrays) and those with a name specified-->
    <?php foreach ($team as $member):?>
     <?php if (is_array($member)):?>
    <?php if ($member["name"] != ""):?>
    
    <!--add class depending on category-->
    <?php switch ($member["category"]):?>
    <?php case "Administration":?>
    <div class="team-member administration">
        <?php break;
        case "Boitumelo":?>
    <div class="team-member boitumelo">
        <?php break;
        case "Computer Center":?>
    <div class="team-member computerCenter">
        <?php break;
        case "Youth Center":?>
    <div class="team-member youthCenter">
        <?php break;
        case "Counselling Center":?>
    <div class="team-member counsellingCenter">
        <?php break;
        case "Performing Arts Department":?>
    <div class="team-member performingArtsDepartment">
        <?php break;
        case "Urban Agriculture Initiative":?>
    <div class="team-member urbanAgriculture">
        <?php break;
        default:?>
        <div class="team-member">
    <?php endswitch;?>
    
    <!-- Display Member -->
        <div class="wrap">
            <div class="member-photo">
                <img src="<?php echo $member['photo'];?>">
            </div>
            <div class="member-description">
                <p><strong><?php echo $member["name"];?></strong></p>
                <p>-<?php echo $member["position"];?></p>
            </div>
        </div>
    </div>
    
    <?php endif;?>
    <?php endif;?>
    <?php endforeach;?>
    </div>

    The problem is that it is returning member 41 as a string instead of an array, even though it is a group with sub-fields and is identical to all other members.
    Any idea how to fix this? Thank you for your help.

  • When having problems with large numbers of fields you are usually running into an issue with the PHP max_input_vars setting. More information here https://www.advancedcustomfields.com/resources/limit-number-fields/

  • Hi John,
    Thank you for your reply, I have tried what is suggested on the link you sent however it doesn’t seem to have fixed the problem. Also fields after the field in question still load perfectly so I do not think it is a max var issue. I even added completely new field groups on that page which all worked without hassle.

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

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.