I wanted to create wordpress post using xmlrpc, for that I am using python wordpress-xmlrpc.
when i am trying to pass custom field for example price
it works well but when I use _price
it does not get inserted to the database.
does anyone has faced issue like me?
I have refered this forum thread.
Here is my code for reference,
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts, NewPost, EditPost
from wordpress_xmlrpc.methods.users import GetUserInfo
from wordpress_xmlrpc import WordPressPost
wp = Client('http://localhost/xmlrpc.php', 'admin', 'a')
post = WordPressPost()
post.title = 'My post'
post.content = 'This is a wonderful blog post about XML-RPC.'
post.post_status = 'publish'
post.post_format = 'quote'
post.custom_fields = [{'key': 'price','value': 2}]
post.custom_fields.append({'key': "_price", 'value': 22})
post.id = wp.call(NewPost(post))
print post.id
Thanks in advance.
This is an old question but maybe somebody will find my answer useful:
basically meta fields starting with underscore prefix
_
are private and will no be shown on admin screen.Here you have answer for similar question: https://wordpress.stackexchange.com/questions/183858/difference-between-meta-keys-with-and-without#answer-183860