maxcutler / python-wordpress-xmlrpc

Python library for WordPress XML-RPC integration
http://python-wordpress-xmlrpc.rtfd.org
MIT License
380 stars 129 forks source link

How to edit value in custom fields? #126

Closed uyin85 closed 5 years ago

uyin85 commented 5 years ago

How to edit custom field value?

  1. I search post id.
  2. After found post id, search specific custom field to edit the value.
  3. Execute below code but only title change. Custom field value not change. post = WordpressPost() post.title = 'Bumblebee' post.custom_fields = [{'key':'idtmdb', 'value':'1234'}] client.call(posts.EditPost(16, post))
ownchoice commented 5 years ago

I'm having the same problem right now.

ownchoice commented 5 years ago

I managed to make it work!

You need to submit the custom field dict including the id.

post = WordpressPost()

post.title = 'Bumblebee'

post.custom_fields = [{'id':'28322', 'key': 'idtmdb', 'value': '1234'}]

client.call(posts.EditPost(16, post))
uyin85 commented 5 years ago

Thank you! Need to add custom_fields id in dict.