Support » Plugin: Simple History » Uncaught Error: Call to undefined function _acf_get_field_by_id()

  • Resolved stuurluidevelopment

    (@stuurluidevelopment)


    Hi guys,

    on a fresh & updated site, we have added Simple History & ACF. After changing content on a page and saving, a WSOD is displayed. The changes are saved.

    PHP shows the following error:

    PHP message: PHP Fatal error: Uncaught Error: Call to undefined function _acf_get_field_by_id() in /var/www/nltabs-bagudasan/wordpress/current/wp-content/plugins/simple-history/loggers/Plugin_ACF.php:374

    Only Simple History & ACF are activated.

    When Simple History is disabled, no issues with WSOD.

Viewing 15 replies - 1 through 15 (of 16 total)
  • letterafterz

    (@letterafterz)

    Also experiencing this error. Seems to only relate to some of my ACF fields (such as date). Turning off simple history fixes the issue.

    I’m going to post this issue on the ACF bug forums as well.

    Quick update: it seems that version 5.7.11 of ACF Pro is causing some issues. ACF released a new version, but things don’t seem to improve much. With that latest version, I’m seeing some issues with WP All Export Pro.

    For now my safest bet would be to downgrade to version 5.7.10 (available on the ACF website).

    So, issue seems to be ACF. Closing ticket!

    ACF Support says _acf_get_field_by_id() was an internal function and was removed in version 5.7.11.

    Plugin Author Pär Thernström

    (@eskapism)

    Sorry to hear about this problem. I will try to release an update to Simple History as soon as possible.

    Having the same issue here with ACF. When trying to update any page I get:

    Error thrown
    Call to undefined function _acf_get_field_by_id()

    Disabling Simple History fixes the issue for me.

    Pär,

    On /wp-content/plugins/simple-history/loggers/Plugin_ACF.php line 374 you have the following:

    $parent_field = _acf_get_field_by_id( $parent_field['parent'] );

    Here’s the entire section:

    if ( 'acf-field' === $parent_field_post_type ) {
         $parent_field = _acf_get_field_by_id( $parent_field['parent'] );
    } elseif ( 'acf-field-group' === $parent_field_post_type ) {
         $parent_field = acf_get_field_group( $parent_field['parent'] );
    } else {
         // Unknown post type.
         break;
    }
    

    So, if ACF has deprecated that function. This is what causing the plugin conflict.

    So, I did a little digging into this and it seems that in version 5.7.11/12 ACF decided to deprecate the function called “_acf_get_field_by_id”. However, in the /advanced-custom-fields-pro/includes/acf-deprecated-functions.php line 57 the function is called “_acf_get_fields_by_id” (Note “fields” in plural) and that seems to be breaking resources that are still using the deprecated _acf_get_field_by_id, due to a typo/misspelling of the function?

    I renamed the deprecated function to “_acf_get_field_by_id” back to singular “field” and Simple History is now working without throwing the error.

    I have also encountered this error with the latest update for ACF pro version.

    Is there an ETA on when Simple History will be updated to fix this?

    Plugin Author Pär Thernström

    (@eskapism)

    Thanks for all the help everyone. I was able to reproduce this myself yesterday so I will update the plugin later today.

    Were we in the right path here Pär? Is it related to the deprecated function in ACF?

    Thank you for your support. We appreciate it!

    Plugin Author Pär Thernström

    (@eskapism)

    Yes it was ACF and a deprecated function!

    Please try the just released version 2.29.2 and let me know if it works. Thanks!

    So ACF mis-spelled their deprecation wrapper function by adding an ‘s’ to ‘field’

    Are they going to break it again?

    Plugin Author Pär Thernström

    (@eskapism)

    Well I also used a function that was not part of the official ACF API so that was unvise of me too. Unlucky combination :/

    @jahshuwaa They have also removed the underscore ( _ ) at the beginning of the function besides adding an “s” to “field”.

    @eskapism Thanks a lot for fixing this! Much appreciated.

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Uncaught Error: Call to undefined function _acf_get_field_by_id()’ is closed to new replies.