Home Forums General Issues How to update ACF Relationship field with serialized data via XMLRPC


How to update ACF Relationship field with serialized data via XMLRPC

  • Hey all,

    I’m using the .editPost XMLRPC method to update my posts’ Custom Fields on WordPress and I’m having trouble getting the Relationship field data right.

    When I look at the info from .getPost, I see fields like this:


    When I pass the same serialized data back to add another post, like 4956 instead of 24076, it doesn’t accept the serialized data a:2:{i:0;s:4:&quot;4596&quot;;i:1;s:5:&quot;12965&quot;;} and instead thinks the entire thing is one string, then serializes that to s:37:&quot;a:2:{i:0;s:4:&quot;4596&quot;;i:1;s:5:&quot;12965&quot;;}&quot;;.

    I’m not sure what to do — is there another way to pass serialized data in? I’ve tried using " instead of &quot; but that also doesn’t take properly; also using \" doesn’t work either.

    Even passing back the original a:1:{i:0;s:5:&quot;24076&quot;;} onto a new post doesn’t work.

    Also, I am already correctly getting the id of the value using getPost and it seems to be saving the data and writing it even though it’s not correctly-formatted.

  • I’m going to preface this with “I don’t really know how to use XMLRPC in WP.

    WP is serializing the value for you. Can you pass the value as an array? The value of a relationship field is an array of post IDs and the post ID values are strings.


    I don’t really know why it’s returning a serialized value, it that something you can control?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.