I'm trying to add new posts over XMLRPC, but for some reason I cannot add custom fields (other content like title and description works).
Pseudo code that I use:
from xmlrpc import client
user = 'admin'
passwd = 'pass'
server = client.ServerProxy('http://domain.tld/xmlrpc.php')
blog_id = 0
custom_fields = []
custom_fields.append(
{'key' : 'my_meta_key', 'value' : 123}
)
blog_content = {
'post_title': title,
'post_content': content,
'post_type': 'product',
'custom_fields': custom_fields
}
post_id = int(server.wp.newPost(blog_id, user, passwd, blog_content, 0))
Posts gets added, however my custom field named my_meta_key
is empty.
Cant see what I'm doing wrong.
Problem is with naming of meta keys. I name them with underscore, like _my_meta_key
, which means they are protected for the API.