<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<font size="-1"><font face="Verdana">Looks to me like the update
operation needs a custom_fields array entry called 'id' in addition to
the 'key' and 'value's. It's the post id.<br>
<br>
When you create a new post with custom fields it calls add_meta(). When
you edit a post with new custom field data without the 'id' field it
tries to do the same thing again. Insert the same rec with the same key.<br>
<br>
Updating the existing custom field only works if 'id' in the custom
field array is set to the post id. You need an 'id' in that associative
array.<br>
</font></font><br>
David Weiss wrote:
<blockquote
cite="mid:ba38506a0904062117q42f5a887y57877c0befc121ba@mail.gmail.com"
type="cite"><font size="2">I can't seem to get the updates to custom
fields to work on existing posts, but creating new posts with custom
fields seems to be working just fine.<br>
<br>
<br>
Creating new post (Success!):<br>
<br>
POST /wordpress/xmlrpc.php HTTP/1.0<br>
Host: <a moz-do-not-send="true" href="http://www.mydomain.com">www.mydomain.com</a><br>
Content-Type: text/xml<br>
User-Agent: The Incutio XML-RPC PHP Library<br>
Content-length: 961<br>
<br>
<?xml version="1.0"?><br>
<methodCall><br>
<methodName>metaWeblog.newPost</methodName><br>
<params><br>
<param><value><int>1</int></value></param><br>
<param><value><string>********</string></value></param><br>
<param><value><string>********</string></value></param><br>
<param><value><struct><br>
<member><name>title</name><value><string>430
N Michigan Ave</string></value></member><br>
<member><name>description</name><value><string>Hello
World!</string></value></member><br>
<member><name>publish</name><value><boolean>1</boolean></value></member><br>
<member><name>custom_fields</name><value><array><data><br>
<value><struct><br>
<member><name>key</name><value><string>_listing_price</string></value></member><br>
<member><name>value</name><value><string>300000</string></value></member><br>
</struct></value><br>
</data></array></value></member><br>
</struct></value></param><br>
<param><value><boolean>1</boolean></value></param><br>
</params></methodCall><br>
<br>
<?xml
version="1.0"?><methodResponse><params><param><value><string>569</string></value></param></params></methodResponse><br>
<br>
<br>
Editing an existing post (Fail!):<br>
<br>
<br>
<br>
</font>
<pre><font size="2">POST /wordpress/xmlrpc.php HTTP/1.0
Host: <a moz-do-not-send="true" href="http://www.mydomain.com">www.mydomain.com</a>
Content-Type: text/xml
User-Agent: The Incutio XML-RPC PHP Library
Content-length: 989
<?xml version="1.0"?>
<methodCall>
<methodName>metaWeblog.editPost</methodName>
<params>
<param><value><string>442</string></value></param>
<param><value><string>********</string></value></param>
<param><value><string>********</string></value></param>
<param><value><struct>
<member><name>title</name><value><string>430 N Michigan Ave</string></value></member>
<member><name>description</name><value><string>Updated Hello World 3!</string></value></member>
<member><name>publish</name><value><boolean>1</boolean></value></member>
<member><name>custom_fields</name><value><array><data>
<value><struct>
<member><name>id</name><value><string>442</string></value></member>
<member><name>key</name><value><string>_listing_price</string></value></member>
<member><name>value</name><value><string>300000</string></value></member>
</struct></value>
</data></array></value></member>
</struct></value></param>
<param><value><boolean>1</boolean></value></param>
</params></methodCall>
</font></pre>
<pre><font size="2"><?xml version="1.0"?><methodResponse><params><param><value><boolean>1</boolean></value></param></params></methodResponse>
</font></pre>
<font size="2"><br>
The ID field in custom fields (442) is the ID for an existing, valid
post in the blog. I've tried this value as a string, casted to an int,
etc. I can't seem to make it work.<br>
<br>
Any ideas or suggestions would be most appreciated. <br>
<br>
</font>
<pre wrap="">
<hr size="4" width="90%">
_______________________________________________
wp-xmlrpc mailing list
<a class="moz-txt-link-abbreviated" href="mailto:wp-xmlrpc@lists.automattic.com">wp-xmlrpc@lists.automattic.com</a>
<a class="moz-txt-link-freetext" href="http://lists.automattic.com/mailman/listinfo/wp-xmlrpc">http://lists.automattic.com/mailman/listinfo/wp-xmlrpc</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
You are not doing anything wrong. Stop trying to do it right.
Burt Adsit</pre>
</body>
</html>