Open kdechant opened 1 year ago
Changing the "initialize" part in class-npx-acf-field-image-aspect-ratio-crop-v5.php to this seems to fix it:
// initialize
$instance = new npx_acf_field_image_aspect_ratio_crop($this->settings);
acf_register_field_type($instance);
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.
@joppuyo I've created a pull request that resolves the issue based on @kdechant's feedback
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: https://github.com/joppuyo/acf-image-aspect-ratio-crop/blob/e9c4c119168042234884f3ba09ecc21440a9ff9e/fields/class-npx-acf-field-image-aspect-ratio-crop-v5.php#L1138