Support

Account

Home Forums Bug Reports 6.0.2 Breaks $image = get_field inside a post call.

Solved

6.0.2 Breaks $image = get_field inside a post call.

  • I have reverted back to 5.12.3 as 6.0.2 breaks any get_field calls inside a post call.
    ‘the_field’ get’s the image ID but get_field presents a error on the page.

    <?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>

    <?php $image = get_field(‘post_preview_image’); etc etc

    <?php endwhile; else: endif; ?>

  • I’m not seeing any issues with this. Please provide more context. What else is happening before this code.

  • Hi John I think I’ve found the issue. It’s also happened on another website.

    The Image field inside a repeater field no longer has the option for Preview Size in V6.0.2.

    Therefore all of my images in repeater fields are breaking.

    I’ve also tried exporting my custom fields from V6.0.2 to a lower version 5.11.4 I get the same error.

    If I instead just manually input the exact same fields into 5.11.4 they work.

    So it seems to possibly be that the option for Preview size not being available breaks it.

  • Preview size has nothing at all to do with and does not affect front end functionality, so I’m a little lost as to why that could be causing the problem you’re having.

  • So I’ve now found that, that image preview is in the new ‘Presentation’ tab.

    However it still breaks the image code that I have always used over 40+ websites.

    The break seems to only be on export.

    So it may be an export issue.

    I’ve tried exporting in V6.0.2 to another site with V6.0.2 and the image fields break.
    I’ve tried exporting in V6.0.2 to V5.11 and the image fields break.

    If I manually enter the fields as the usually are in V5.11 they work.

    If I manually enter the fields in V6.0.2 the image field works.

    So it seems to be an export issue with V6.0.2.

    I hope that helps.

  • Ok I think I’ve got it John, it was puzzling me too.

    It seems to be an export issue for img fields inside repeaters.

    Exporting from one WordPress to a local build.
    Same WordPress versions.

    The image fields break when:

    Exporting in V6.0.2 to V5.11.
    Exporting in V6.0.2 to V6.0.2.

    I can Export from V6.0.2 into another V6.0.2 then delete the IMG fields only and manually re-add them. This solves the problem.

    This issue happens on two different website for me.

    Now that I have a solve it doesn’t bother me. I’m sure if you can’t re-create the issue it will be hard to fix.

  • So this has specifically to do with exporting and importing?

    I would say that you won’t be able to export from 6 and import into 5.

    For the 6 => 6 what format are you exporting the group to? JSON?

  • Yes correct, it seems to be an export issue with IMG fields in repeaters.

    The issue still happens for me for the 6=>6 and I’m using JSON to export.

    Thanks John

  • I have just tried doing an export and import of a field group and the image fields in the repeater continue to work as expected.

    You might have something else interfering with it, it could be that this was not a problem before and now it is.

    I would start with the basics, deactivating plugins, trying a different theme.

  • Hi John,

    I have tried on multiple themes and I get the same issue.

    It’s ok tho as I have the workaround of just deleting the imported img fields and manually re-adding them with the exact same terminology and it then works.

    All good, thanks for your help tho.

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

You must be logged in to reply to this topic.