ACF Fields

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #3994
    ralphnohe
    Participant

    I have a custom post type and want to deploy a global snippet (type: event) to all those custom post types. Several of the used schema properties are using an ACF field content. After adding the global snippet and putting it live, several of the individual posts of the custom post type stop working, i.e. I get the famous WordPress white screen error. I initially thought this might have to do with several ACF fields that I had added over time, because some of the newer posts are working while older ones stopped working suddenly. But looking at the different properties used in the global snippet, I do not see any ACF field used which was changed since inception, so this is likely not the reason for the error. I’m looking forward to any idea what might cause the issue or what I could do to troubleshoot here. Thanks so much!

    #3995
    ralphnohe
    Participant

    I have some additional questions related to the one above:

    1) is it possible to set conditional properties, which are only active if an ACF field exists in a post (assuming that not all fields are used in all posts)?

    2) is it possible to make the entire markup, e.g. for an event schema, conditional, i.e. the schema markup isn’t inserted in a post if NOT ALL of the ACF fields used in the properties have values?

    #3996
    Florian
    Keymaster

    Hey there,
    and thanks for your message. I hope you’re doing well today.

    The only way to find that error is to activate DEBUG Log as described here: https://wordpress.org/support/article/debugging-in-wordpress/#wp_debug_log
    After activating the debug log functionality, reload the page with the white screen and check the debug.log file. You should see a “FATAL Error” anywhere. You can also post the content of the file here if you want.

    1) is it possible to set conditional properties, which are only active if an ACF field exists in a post (assuming that not all fields are used in all posts)?
    > Currently not (without programming knowledge)

    2) is it possible to make the entire markup, e.g. for an event schema, conditional, i.e. the schema markup isn’t inserted in a post if NOT ALL of the ACF fields used in the properties have values?
    > Currently not (without programming knowledge).

    Hope that helps

    #4004
    ralphnohe
    Participant

    hi Florian,
    Thank you very much for your guidance. Here you go – the following is a copy of the Debug Log Fatal Error message I am getting. The field mentioned several times is an ACF date picker field. Looking forward to hearing from you – thank you for any hints what could cause the error!

    BR
    Ralph

    Fatal error: Uncaught Error: Call to a member function format() on bool in /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/pro/classes/model/acf.php:261 Stack trace: #0 /usr/www/users/nftpip/nftpilot-staging1/wp-includes/class-wp-hook.php(307): wpbuddy\rich_snippets\pro\ACF_Model::acf_field(‘field_61ab7251f…’, Object(wpbuddy\rich_snippets\Rich_Snippet), Array, false) #1 /usr/www/users/nftpip/nftpilot-staging1/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘field_61ab7251f…’, Array) #2 /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/classes/objects/rich-snippet.php(860): apply_filters(‘wpbuddy/rich_sn…’, ‘field_61ab7251f…’, Object(wpbuddy\rich_snippets\Rich_Snippet), Array, false) #3 /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/classes/objects/rich-snippet.php(955): wpbuddy\rich_snippets\Rich_Snippet->get_the_value(‘field_61ab7251f…’, Array) #4 /usr/www/users/nftpip/nftpilot-stagin in /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/pro/classes/model/acf.php on line 261

    #4006
    ralphnohe
    Participant

    p.s. the field is NOT filled in this example, i.e. it is an optional field and empty for this specific post which throws the error (and I assume, all other posts which throw an error). I would still expect SNIP to work, i.e. override the missing value with a standard value if that is possible. I have advanced (but not expert) programming knowledge, so even a more complex solution should work.

    • This reply was modified 2 years, 7 months ago by ralphnohe.
    #4009
    Florian
    Keymaster

    Hey there,
    thanks for going back with this info.

    It seems that the problem appears to be from a time, datetime or date field. I’m not quite sure why this happens (as I was not able to reproduce it) but I could at least fix the fatal error.

    Maybe you can update to version 2.28.3 of SNIP which should be available later this day. Here is how you can update it if you don’t see the update yet: https://rich-snippets.io/automatic-updates/#updates_not_appearing

    Please test it again and check if the field is printed out in your schema when filled.

    Greetings
    Florian

    #4012
    ralphnohe
    Participant

    Hi Florian, thank you for getting back to me. I updated to2.28.3 but the fatal error persists. However, it seems it has changed slightly (same post URL as before). If you like, I can grant you direct access to our staging site, please let me know. Thank you and best regards – Ralph

    Fatal error: Uncaught Error: Call to a member function format() on bool in /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/pro/classes/model/acf.php:258 Stack trace: #0 /usr/www/users/nftpip/nftpilot-staging1/wp-includes/class-wp-hook.php(307): wpbuddy\rich_snippets\pro\ACF_Model::acf_field(‘field_61ab7251f…’, Object(wpbuddy\rich_snippets\Rich_Snippet), Array, false) #1 /usr/www/users/nftpip/nftpilot-staging1/wp-includes/plugin.php(189): WP_Hook->apply_filters(‘field_61ab7251f…’, Array) #2 /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/classes/objects/rich-snippet.php(860): apply_filters(‘wpbuddy/rich_sn…’, ‘field_61ab7251f…’, Object(wpbuddy\rich_snippets\Rich_Snippet), Array, false) #3 /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/classes/objects/rich-snippet.php(955): wpbuddy\rich_snippets\Rich_Snippet->get_the_value(‘field_61ab7251f…’, Array) #4 /usr/www/users/nftpip/nftpilot-stagin in /usr/www/users/nftpip/nftpilot-staging1/wp-content/plugins/rich-snippets-wordpress-plugin/pro/classes/model/acf.php on line 258

    #4014
    Florian
    Keymaster

    Hey there,
    that would be nice. This way I can see your configuration as well. Please send the information via email to support [at] wp-buddy.com.

    Thank you! 😉

    #4016
    ralphnohe
    Participant

    Thank you very much Florian, I just forward to you the login details.
    Best regards, Ralph

    #4021
    ralphnohe
    Participant

    Dear Florian,
    I have updated to 2.28.4 and now it works fine. Thank you again for the great help – herzliche Grüße aus Nürnberg.
    Ralph

Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.