Custom fields not updating via REST API
Seems like it still doesn't work. Meta data fields i POST through the WP API remain empty. Whether i set "Allow All Fields To Be Updated" or allow one by one on field level. Should i raise a new issue for this?
Originally posted by @kilianso in https://github.com/pods-framework/pods/issues/7318#issuecomment-2232900895
Hi there! Any workaround while 3.2.6 is out?
Trying to get this into Pods 3.2.6 for release tomorrow.
https://github.com/pods-framework/pods/pull/7329
If anyone has time before tomorrow's release, I'd appreciate you trying Pods 3.2.6 out and letting me know if that resolves the write issues you're having.
release/3.2.6 https://github.com/pods-framework/pods/archive/refs/heads/release/3.2.6.zip
To help address the issue here, I added some automated testing coverage for it to help ensure long term stability.
If anyone has time before tomorrow's release, I'd appreciate you trying Pods 3.2.6 out and letting me know if that resolves the write issues you're having.
release/3.2.6 https://github.com/pods-framework/pods/archive/refs/heads/release/3.2.6.zip
I just installed it, I let you know if It works or if anything else is required
@miguelomonroyb any luck?
@sc0ttkclark I just quickly tested it on a stage environment using 3.2.6-a-1 and the issue persists for me. The data i POST looks something like this:
data: { status: 'draft', title: 'ABC' meta: { origin_url: 'abc.com' } }
I'm hitting the endpoint /wp-json/wp/v2/myCPTname
The field 'origin_url' remains empty. 'title' and other non-meta fields are submitted and saved correctly.
I tried each settings combination. "Allow All Fields To Be Updated" activated/deactivated and "Read/Write via REST API" activated/deactivated on field level.
Since you're using the meta level field saving, I'll look at this a bit further from that side.
Same here, I'm using the meta level field saving and still the issue persists
To confirm, you have the "Register meta fields" option enabled in your Pods Admin > Settings, correct?
I just enabled it, I will try it again
I'm releasing Pods 3.2.6 in the meantime, I can work more on this for Pods 3.2.7 but this release has to go out to address the bigger issue that impacted those using WP 6.5 and below.
@sc0ttkclark I made a few tests and think I've narrowed down the issue. It seems related to the REST API settings here: Pods Admin > Edit Pods > CPTNAME > REST API.
- Submitting the metadata flat rather than inside a meta object resolves the issue, but only if the setting "Show as a custom object field (response.field_name)" is active, rather than "Include in the meta object (response.meta.field_name)". If the latter is chosen, neither submitting flat nor as a meta object will update the fields.
- The global setting "Allow All Fields To Be Updated" seems broken. Allowing read/write access on the field level, however, works.
I'm on WordPress 6.6 and Pods 3.2.6.
@kilianso Could you also verify #7339 and let me know if it works for you?