airesvsg / acf-to-rest-api

Exposes Advanced Custom Fields Endpoints in the WordPress REST API
https://wordpress.org/plugins/acf-to-rest-api/
1.33k stars 111 forks source link

Post/Put of user acf fields #276

Open jdiericks opened 6 years ago

jdiericks commented 6 years ago

Hi,

So I am experiencing a interesting issue.

When it comes to updating acf fields on posts and custom post types, it works perfectly. When I submit a request to edit an acf field on the user profile, the server responds with 200. However when I look at the fields, it appears as if nothing is ever sent.

My code for the request:

setVoted(id){
          var vm = this;
          var token = this.getCookie("wcmCookie");
          HTTP.post('/wp/v2/users/'+id,{
                fields:{
                  'voted': 'true'
                }
          },{
            headers:{
              'authorization': 'Bearer' + token,
            }
          })
            .then(function (response) {
              console.log(response)
            })
            .catch(function (error) {
              console.log(error);
            })
        },
watzing commented 6 years ago

Did you manage to solve this? I'm having the same issue

jdiericks commented 5 years ago

@watzing I was finally able to get my setup working: the solution suggested here worked for me.

https://github.com/airesvsg/acf-to-rest-api-example/issues/1#issuecomment-183675782