1
我有使用蟒蛇的wordpress-XMLRPC的问题时,它会作出新的岗位与预先存在的类别,但有一个错误如下:错误500:提供名称的术语已经存在于此父项中。
Fault: <Fault 500: 'A term with the name provided already exists with this parent.'>
我用的脚本:
categorys = ['cat_1', 'cat_2']
post = WordPressPost()
post.post_type = 'post'
post.terms_names = { 'post_tag': categorys, 'category': categorys }
post.title = title
post.content = content
post.post_status = 'publish'
post.thumbnail = attachment_id
client.call(posts.NewPost(post))
注: “cat_2” 是旧范畴。
我使用VPS服务器。
请帮忙!
你找到任何解决办法? – vaibhav
hello @vaibhav我找到了解决方案。 你可以使用如下的脚本: '进口CGI 的categorys = cgi.escape(的categorys,真) post.terms_names = { 'post_tag':的categorys, '类别':的categorys}' – Tarjo
感谢@Tarjo ...我已经找到了解决方案,再次欢迎 – vaibhav