-
-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rest API throws "Fatal Error: Call to undefined method stdClass::format_value_for_rest()" #130
Comments
Changing the "initialize" part in class-npx-acf-field-image-aspect-ratio-crop-v5.php to this seems to fix it:
This is how the other plugins register their fields, including the fields built in to ACF itself. Anyone know if there is any reason that wouldn't work? |
Hey, thanks for the detailed bug report. Unfortunately I have very limited time to maintain this plugin but I will try to fix this issue as soon as possible. |
…thod stdClass::format_value_for_rest()"
I have reserved some time next week to look through all issues in this plugin and I will also try to solve this issue. |
Hey, right now version 6 of this plugin is minimally maintained and it gets only bug fixes. New features like ACF REST API compatibility will be added in version 7. |
When using an "Image Aspect Ratio Crop" field that is exposed to the WP REST API, I get a PHP error.
GET http://my.site.domain/wp-json/wp/v2/pages returns this:
This happens when I use the following plugins together:
There is a Field Group with a field of type "Repeater". One of the sub-fields of the repeater is the "Image Aspect Ratio Crop" field. The Field Group has the "Show in REST API" setting turned on.
The error also appears when I try to edit content in the WP admin.
The error doesn't occur when using
?acf_format=standard
in the query string. (e.g.,GET http://my.site.domain/wp-json/wp/v2/pages?acf_format=standard
) but that doesn't fix the WP admin.It appears that this occurs because the plugin doesn't call
acf_register_field_type
to register the field class here:acf-image-aspect-ratio-crop/fields/class-npx-acf-field-image-aspect-ratio-crop-v5.php
Line 1138 in e9c4c11
The text was updated successfully, but these errors were encountered: