Support

Account

Home Forums Bug Reports $is_preview no longer hiding content on front end

Solved

$is_preview no longer hiding content on front end

  • It appears somewhere between ACF v5.8.9 and v5.8.13 (these are the versions I was updating from to) the default $is_preview variable (as seen in ACF Blocks: https://www.advancedcustomfields.com/resources/blocks/) is no longer hiding content from the front-end.

    I use the same “is-admin” class in many blocks on my site, the same way Elliot does in his tutorial here: https://www.advancedcustomfields.com/blog/building-a-custom-slider-block-in-30-minutes-with-acf/, that class is now showing on the front-end, to logged out users. I didn’t make any other changes to my site besides updating to WordPress 5.5 (no issues) and then updating ACF and other plugins, none of which interact with ACF.

  • On further testing, it appears I must have not cleared my cache after the WordPress update. It seems the 5.5 update is the real culprit that’s breaking this. I updated just WordPress on a website with ACF v5.8.11 and recreated the issue.

  • I just updated to WordPress 5.5 and $is_preview is no longer working, as mentioned above.

    This is a critical error – resulting in all ACF blocks no longer working on the front-end of the site.

    How do we fix this?

  • I can confirm that $is_preview is now always returning true in WordPress 5.5. It would be great if you could fix it ASAP, because I’m using this conditional a lot (I was inspired by ACF documentation) and it will break all my latest websites that will automatically upgrade WordPress to version 5.5.

  • Thanks John, I have contacted support and reiterated and linked back to this thread. Hope this will have a solution soon!

  • Just wanted to follow-up with the rest of everyone here that is_preview content shows on the front-end in WordPress 5.5, I have as well submitted a bug report.

  • Submitting a bug report as I am seeing the same behaviour on 5.5.

    I have a live site that relies heavily on is_preview to render content differently in Gutenberg versus the front end. Now is_preview is returning true on the frontend.

  • My guess is the culprit is /advanced-custom-fields-pro/pro/blocks.php line 523 if( !empty($query['preview']) ) {. Assuming $query['preview'] is no longer evaluating as empty on the frontend.

    Unfortunately, I do not have a local install of wordpress with 5.5 to see what $query['preview'] evaluates to on the frontend as of the latest update and I am currently busy with a deadline.

    Good luck with the bug hunting!

  • Hi all,

    We have released a 5.8.14 update to take care of this bug – thanks again for your help!​​

  • Thanks so much! The update has fixed the issue on my sites.

  • This is not the case for me unfortunately. I use render_template, and the is_preview variable there is a block object, not a true/false variable.

    WP 5.5, and acf-pro 5.8.14

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

You must be logged in to reply to this topic.