【发布时间】:2019-08-21 04:24:12
【问题描述】:
我在我的网站上使用 wp 作业管理器。当我尝试通过 xmlrpc 添加列表时,一切正常,但类别和位置为空。
我的代码如下。你能告诉我我的代码有什么问题吗? 谢谢
from wordpress_xmlrpc import Client, WordPressPost
from wordpress_xmlrpc.methods.posts import GetPosts
from wordpress_xmlrpc.methods import posts
from wordpress_xmlrpc import WordPressTerm
from wordpress_xmlrpc.methods import taxonomies
wp = Client('http://127.0.0.1/15wp/xmlrpc.php', 'admin', '123456')
# now let's create a new product
widget = WordPressPost()
widget.post_type = 'job_listing'
widget.title = 'Widgetlast02'
widget.content = 'This is the widgets description.'
widget.post_status = 'publish'
widget.custom_fields = []
widget.custom_fields.append({
'job_location': 'Newyork',
'job_listing_category': 'hotel'
})
widget.id = wp.call(posts.NewPost(widget))
【问题讨论】:
标签: python-3.x wordpress xml-rpc