Closed n-kort closed 2 years ago
Yep seeing that here also.
Me three
I'm having a difficult time replicating this, to the point I can't submit a PR, but I believe the fix is the following:
add_action( 'rest_api_init', array( __CLASS__, 'create_rest_routes' ), 10 );
needs to be changed to:
add_action( 'rest_pre_dispatch', array( __CLASS__, 'create_rest_routes' ), 10 );
In class-acf-to-rest-api.php
Try setting "Show in REST API" to true for the field-group(s) in ACF Field Group editor. I think the setting is rather new.
@willers-pm that causes other errors in my case, but while testing some months back I noticed the schema is different anyway, so held off using the native acf rest support.
@jack-pallot yes changing rest_api_init
to rest_pre_dispatch
does fix it 🎉 That change also seems to work with ACF 5.11.4
@n-kort @jack-pallot changing rest_api_init
to rest_pre_dispatch
does fix it for me, too. Even for the "relationship"-field where activating the setting in ACF would not fix it. So thanks! :)
I'm happy to submit a PR since this seems to be working. I'm guessing it should probably just target ACF 5.12 and above to avoid breaking any older code.
Custom fields content isn't showing in rest endpoints any more, it's just an empty array.