Home Forums Front-end Issues Some ACF fields return empty (some not)


Some ACF fields return empty (some not)

  • I am having an issue that is driving me crazy.
    My problem is as follows, some input (about opening hours) is entered in my wordpress backend (via ACF fields plugin).
    It looks like this (note that everything is filled in): 1

    My code is nothing special, just as you would call any ACF field, so as follows:

    `echo “Ma: “; echo the_field(‘maandag’); echo “<br />”;
    echo “Di: “; echo the_field(‘dinsdag’); echo “<br />”;
    echo “Woe: “; echo the_field(‘woensdag’); echo “<br />”;
    echo “Don: “; echo the_field(‘donderdag’); echo “<br />”;
    echo “Vr: “; echo the_field(‘vrijdag’); echo “<br />”;
    echo “Zat: “; echo the_field(‘zaterdag’); echo “<br />”;
    echo “Zon: “; echo the_field(‘zondag’); echo “<br />”;
    echo the_field(‘speciale’);
    echo the_field(‘vakantie’); `

    On my webpage it looks like this:

    I am literally baffled as to why it only shows some of the fields and others not.

    Note that at first it did show all the different days (monday to sunday), but it did NOT show my 2 textarea’s. So I did some googling and some results told me that a maximum number of vars might have been reached, so I deleted wednesday and thursday to check if my textareas would work. This obviously did not work, as soon as i readded wednesday and thursday, those did not work anymore either.
    What I noticed is that when I completely delete the new post type in my wordpress back end (permanently delete it, it would still show me values).
    I have no clue what is going on!

    Thanks in advance

  • Something tells me you’re not getting values from where you think you’re getting them from. The reason I say that is that you say you deleted something but the values still appear.

    What are the location rules for this field group?

  • My location rule is:

    Show this field group if post type equals openingsuren .

    This is how I do it for all my pages and it all works fine, however not on this one.
    Isn’t it weird that it works for a couple of the variables but not all?

    Right now what I did was delete everything, deleted the group and deleted the custom post type. I remade the group and custom post type (with different names), I also deleted the old fields in the wordpress database and checked the new fields, they are in there with the correct values.

    However, now I just don’t get any results back anymore. Everything is empty now (for my opening hours, all the rest still works).

  • Since you’ve done this before I’m assuming that you have a template file named “single-{$cpt-slug}.php” for showing the values.

    The only thing that leaves is something in the template. Are you doing a query? What does the code for The Loop look like?

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

You must be logged in to reply to this topic.