ACF option fields do not render in Query Addon 5.9.9

14

This worked fine in 5.9.8, but stopped working in 5.9.9. When I roll back to 5.9.8, everything works fine again. Everything else is on their latest version.

To be perfectly clear, this is about ACF’s option page. Normal ACF fields seem to work fine.

info@yourlive.nl

⏱

Replies

Responses

  1. do you use ACF options or Site Options type to retrieve?

  2. due to security, it’s not supported to use all fields now, if you need to retrieve ACF site option, just use ACF Site option instead just site option

  3. So now I have to go and find all instances on all sites where I’ve used this manually to fix this? I’ve used this functionality so I wouldn’t have to hunt all instances…You can’t just introduce a breaking change like this that will break existing websites! You should have automatically migrated all instances from Site Options to ACF options so it wouldn’t break anything. This is not acceptable.

  4. this practically worked always. We always have ACF option field and Site option field. Question is why you used Site option to retrieve ACF option?
    anyway it’s possible to add migration, we have filter and you just need to add function that adds your field names to supported. Do you use child theme?

  5. My point is you can’t just push something that can break websites. You should make sure everything is backwards compatible. That’s what professional software does.You already did this a few years ago when the old preset system suddenly didn’t work anymore and broke a bunch of my older (client) sites, and now again. I have to be able to rely on the software I use.

    1. Security has more priority, it it’s reported to security team we react immediately.

      Here is snippet that restores previous all options to be retrieved

      This is if you just want to add specific keys to be not restricted

      add_filter('greenshift_dynamic_allowed_options', function ($allowed) {
          $allowed[] = 'my_theme_phone';
          $allowed[] = 'my_theme_address';
          $allowed[] = 'my_plugin_settings'; // bracket paths like my_plugin_settings[contact][email] work too
          return $allowed;
      });

      This is if you need to restore previous all options to be available

      add_filter('greenshift_dynamic_allowed_options', function ($allowed) {
          global $wpdb;
          $names = $wpdb->get_col("SELECT option_name FROM {$wpdb->options} WHERE autoload IN ('yes','on')");
          return array_merge($allowed, $names);
      });
  6. I assume it might be the sameissue.Bug Report: ACF Site Option dynamic binding crashes Image element block preview in Gutenberg editor

    I found an issue with Dynamic Content rendering when using the “ACF Site Option” source in the Image element block.

    Environment:

    Greenshift / Greenlight Pro

    ACF Pro (Options Page)

    Field Return Format in ACF: Image ID (integer)

    Steps to Reproduce:

    Create an ACF Options Page field (e.g. field name: image-fieldname, return format: ID to Image URL).

    Add an Image Block in Gutenberg and open Dynamic Content settings.

    Select Source: “Site data” -> “ACF Site Option”.

    Set Option Name to clean field name: image-fieldname (without the options_ prefix, as required by ACF get_field).

    Set Add Data Format: “ID to Image URL (Full size)”.

    Observed Behavior:

    In Gutenberg Editor: The block crashes immediately with the error: “This block has encountered an error and cannot be previewed”.

    On Frontend: The image renders completely fine.

    Additional Testing Notes:

    If I change the field name to options_qr-alfa with “ACF Site Option” or “Site Option”:

    In Gutenberg Editor: Preview in Gutenberg editor works and displays the image.

    On Frontend: Fails to render (no tag generated on frontend because get_field('options_image-fieldname‘, ‘option’) looks for non-existent options_options_image-fieldname).

  7. I would like to use ACF Site Option – image-fieldname,but it crashes in gutenberg editor.It seems there is an uncaught JS error in the editor’s REST API / preview handler when parsing ACF Site Option with a clean field name and converting ID to Image URL.

    Could you please check the REST API evaluation logic for ACF Site Option in the editor?

    Thank you!

  8. would like to comment this:

    this practically worked always. We always have ACF option field and Site option field. Question is why you used Site option to retrieve ACF option?

    I like greenshift, but sometimes, especially query / dynamic things, are driving me, and I guess other users, little bit confused.

    I remember checkbox “This issue is related to Query / Dynamic” that appeared in previous support system after some time of using that service. I think this is the reason.

    I used to use Elementor and other tools to build websites, and dynamic things in other tools I tried were Always Intuitive.

    With Greenshift these things are many times impossible to guess, I remember many support tickets I wrote to support related to dynamic things where I stuck.

    I rememeber I wrote many support tickets about this particular issue with retrieving images from ACF – Options page. I remember it was the last thing I could manage to make it work, after month or even years of trying to make it work. I was avoiding retrieving pictures from ACF – Options page.

    I cannot say 100% correct (it was long ago), but I think it is 95%+ chance, that thу answer to this question:

    Question is why you used Site option to retrieve ACF option?

    Is “Because Greenshift support told me to do so” after countless attempts to figure it out myself.

    Dont get me wrong, I like greenshift and willing to keep using it.

    The functionality part is great, but invest some time into Interface and interaction with user. Mosaic or even Elementor is a good example of interacting with user.

  9. check what exactly ACF returns. Use text block and see what is returning. Maybe ACF returns not ID but arrays or something another

  10. I have already done a full PHP debug step-by-step using a custom shortcode (get_field('image-fieldname', 'option')) directly on the page to verify what ACF returns.

    What ACF actually returns:

    It returns a strict integer ID: int(47041).Using wp_get_attachment_image_url(47041, 'full') and wp_get_attachment_image(47041, 'full') successfully outputs both the valid image URL and the full <img> HTML tag on the frontend. So ACF return format, database integrity, and media attachments are 100% correct.

    The Current Conflict:

    When using Site Option with options_image-fieldname:

    In Gutenberg: The editor preview works fine.

    On Frontend: Fails completely (no <img> tag) due to the new 5.9.9+ security restriction on wp_options keys (unless manually whitelisted via the greenshift_dynamic_allowed_options filter).

    When using ACF Site Option with clean field name image-fieldname:

    On Frontend: Works as expected. The image renders correctly.

    In Gutenberg: The block crashes in the editor with the error: “This block has encountered an error and cannot be previewed”.

    Steps to Reproduce the Gutenberg Editor Crash:

    Create an ACF Options Page field set to Return Format = Image ID (e.g. field name: image-fieldname).

    Add a Greenshift Image block on a page in Gutenberg.

    Open Dynamic Content settings: Select Site data -> ACF Site Option.

    Set Option Name = image-fieldname (clean ACF field name, without the options_ prefix).

    Set Add Data Format = ID to Image URL (Full size).

    Observe: The block crashes in the Gutenberg UI with “This block has encountered an error”, even though saving the page and viewing it on the frontend works perfectly.

    Conclusion:

    ACF is working properly and the frontend logic for ACF Site Option is correct. The issue is strictly a JS/React exception handling error in the Gutenberg editor when evaluating ACF Site Option with ID to Image URL formatting in the backend preview.

    Could you please fix this JS evaluation crash for ACF Site Option in the next plugin update?

    P.S. On a side note, I want to mark the Greenlight block settings right sidebar UI. It is really good designed, fast and very convenient for use.

  11. Image element crashes when Dynamic Link – Site data – ACF Site Options – field is chosen.Any updates on this issue?

    1. issue is added to Fix list and will be fixed in nearest update of query addon

Post a Reply