Home Forums Bug Reports ACF 5.7.11 Breaks Image Field


ACF 5.7.11 Breaks Image Field

  • We often use Flexible content for the layouts in our clients sites. An issue i’ve come across in the 5.7.11 update us that if you have an image field with the name image i’m unable to get the value. However, if I rename it so say card_image i’m able to get it. Yet in both cases if I use get_field_objects() to list the pages flex content,image shows.

    So to clarify further:
    $image = get_sub_field('image');
    Doesnt work anymore, but the following does:
    $image = get_sub_field('card_image');

    Maybe using the name image was too generic in the first place, however we have 10s of sites using this and so update them all, and then update the content to have the correct image again will cause all kinds of headaches, not to mention the time it’ll take.

  • Sounds like the same issue I was having with get_sub_field –

    Seems like the issue was perhaps with sub-fields named the same as the field type, since the issue I had was with a field called “text”.

  • You’re right, sounds like the same issue. However I re-downloaded the updated version this morning which fixed an issue with out options page generated with register_field_group(), however this flexible content is created in WP admin, not from our code. The updates not resolved this issue for me unfortunately.

  • @dd_james

    My apologies for the issues in version 5.7.11.
    I am confident we have found and fixed the issue.

    Can you please re-download the ACF PRO plugin files and test the issue?

    An easy way to re-download is to edit the main acf.php plugin file and change the version number ‘5.7.11’ down to ‘5.7.10’
    – please note the version number appears twice in this file and both will need to be changed
    – after this change is made, please update the plugin as per normal and it will update to 5.7.11 (including the new fix)

  • Hi @elliot,

    No worries I’ve followed your steps above and updated, however the issue persists unfortunately.

    So here’s the output of get_field_objects():

        [flex] => Array
                [ID] => 52
                [key] => field_5c59ba9a49e2c
                [label] => Flexible Content
                [name] => flex
                [prefix] => acf
                [type] => flexible_content
                [value] => Array
                        [1] => Array
                                [acf_fc_layout] => text_image_card
                                [title] => About Example
                                [text] => Duis pulvinar sed mauris at tempus. Maecenas at dapibus nisi, sed congue velit.
                                [link] => Array
                                        [title] => 
                                        [url] => https://example.test/
                                        [target] => 
                                [image] => Array
                                        [ID] => 82
                                        [id] => 82
                                        [title] => ladies
                                        [filename] => ladies.jpg
                                        [filesize] => 127509
                                        [url] => https://example.test/wp-content/uploads/2019/02/ladies.jpg
                                        [link] => https://example.test/home/ladies/
                                        [alt] => 
                                        [author] => 3
                                        [description] => 
                                        [caption] =>  
                                        [name] => ladies
                                        [status] => inherit
                                        [uploaded_to] => 19
                                        [date] => 2019-02-06 14:12:57
                                        [modified] => 2019-02-06 14:12:57
                                        [menu_order] => 0
                                        [mime_type] => image/jpeg
                                        [type] => image
                                        [subtype] => jpeg
                                        [icon] => https://example.test/wp-includes/images/media/default.png
                                        [width] => 800
                                        [height] => 800
                                        [sizes] => Array
                                                [thumbnail] => https://example.test/wp-content/uploads/2019/02/ladies-150x150.jpg
                                                [thumbnail-width] => 150
                                                [thumbnail-height] => 150
                                                [medium] => https://example.test/wp-content/uploads/2019/02/ladies-300x300.jpg
                                                [medium-width] => 300
                                                [medium-height] => 300
                                                [medium_large] => https://example.test/wp-content/uploads/2019/02/ladies-768x768.jpg
                                                [medium_large-width] => 768
                                                [medium_large-height] => 768
                                                [large] => https://example.test/wp-content/uploads/2019/02/ladies.jpg
                                                [large-width] => 800
                                                [large-height] => 800
                                [text_side] => right
                                [card_colour] => navy
                [button_label] => Add Content
                [min] => 
                [max] => 
                [_name] => flex
                [_valid] => 1

    And so we have a flex file which routes to the relevant flex component:

    if (have_rows('flex')) {
        while (have_rows('flex')) {
            include locate_template('components/flex/content-' . get_row_layout() . '.php');

    And in my content-text_image_card.php file I’m using:

    $image = get_sub_field('image');
    $link = get_sub_field('link');

    $link works, $image doesn’t. If I change the name of the image field from image to card_image then get_sub_field('card_image'); works.

    As previously mentioned, the naming could certainly be better on my part, however it’s kind of set on a lot of our projects so changing now is a big job.


  • To further this, I’ve created a new flex layout called Cards, so I have a template called content-cards.php. In here I have a repeater field called cards, this shows in the get_field_objects() but not when I use the usual ‘have_rows(‘cards’))’, however if I rename it to have_rows('card_blocks')) then it does. Again, the naming could be improved on my behalf, however these are things that worked prior to 5.7.11, so there’s defiantly some weirdness happenings still.

    Interestingly, in this repeater field I have an image field called image which is working. Not sure if it’s because the scopes different in a repeater, but may be of use.

  • @dd_james Thanks for the info. This issue sounds like fields are being incorrectly cached in storage.

    Can you please open a support ticket via the following link and include a .json export + PHP code to replicate the issue?

  • Hi Elliot,

    So the most recent update (5.7.12) seems to have resolved the images. I do still have the issue with using the name cards for the repeater in a flex block called cards, but honestly, renaming that in this case is fine.

    In regards to the cache, is there an SQL query I can run to clear it, like clearing transients?


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

The topic ‘ACF 5.7.11 Breaks Image Field’ is closed to new replies.